Post date: 2017/11/18 6:05:06
追記:2020−3−2
バージョン確認 chef-server-ctl version
chef-server-ctl reconfigure
chef-server-ctl backup Do you wish to proceed? にyすると、serverを停止、バックアップ、再開
/var/opt/chef-backup に.tgzファイルが生成される
-rw-r--r-- 1 anagix anagix 26422717 3月 2 23:20 chef-backup-2020-03-02-22-59-22.tgz
dpkg -i /tmp/chef-server-core_12.19.31-1_amd64.deb し、postgresqlが要るよう
なので、apt install postgresql
ed /opt/opscode/embedded/cookbooks/private-chef/attributes/default.rb して、
default['private_chef']['postgresql']['listen_address'] = node['network']['interfaces']['lo']['addresses'].keys.join(',')を、
default['private_chef']['postgresql']['listen_address'] = "localhost"に変更するも、
chef-server-control reconfigureすると、以下のエラーで対策わからずギブアップ
Error executing action `create` on resource 'component_runit_supervisor[private_chef]'
=================================================================
Chef::Exceptions::EnclosingDirectoryDoesNotExist
------------------------------------------------
template[/etc/init/private-chef-runsvdir.conf] (/var/opt/opscode/local-mode-cache/cookbooks/enterprise/resources/component_runit_supervisor_upstart.rb line 23) had an error: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory /etc/init does not exist.
追記:2020−3−3
dockerにやはり入れたかったので、ubuntuがだめならcentos 7で、と以下を参考にトライした:
https://www.nachum234.com/automation/chef/how-to-install-chef-server-inside-docker-container/
が、記事はchef server 13だったのに対し、入れたかったのは12で、reconfigureでCannot find a resource for component_runit_supervisor on centos というエラーがでるのであきらめた。そもそも少し古い記事によると、chef serverはdockerを考慮してない。
旧サーバで、chef-server-ctl backup
ubuntu18.04に新サーバ立ち上げ
chef-server-ctl restore -t 60000 [backupfile]
サーバ名の設定:/etc/opscode/chef-server.rb に、api_fqdn 'install.anagix.com'
chef-server-ctl reconfigure
certbotインストール
chef-server-ctl stopし、80番ポートを開ける
./certbot-auto certonly --standalone -d install.anagix.com
/var/opt/opscode/nginx/ca で、ln -s /etc/letsencrypt/live/install.anagix.com/fullchain.pem install.anagix.com.crt & ln -s /etc/letsencrypt/live/install.anagix.com/privkey.pem install.anagix.com.key
chef-server-ctl start
追記:2019-4-19
UBUNTU 18.04 (正確には、LinuxMint 19.1)に Chef Server 12をインストールした
hostname を Anagix-12 にしたまま、install.anagix.com用の letsencrypt証明書を使おうとしてはまった
chef-server-ctl reconfigureすると、/var/opt/opscode/nginx/caに、Anagix-12.crtと、Anagix-12.keyが作られ、install.anagix.com.crt, install.anagix.com.keyのシンボリックが使われない。結局、hostnameをinstall.anagix.comに変更した
ポート番号を443以外に変更したかったができなかった
1.chef serverのダウンロードサイトから、debファイルをダウンロードし、dpkg -iでインストール
2.chef-server-ctl reconfigure
3.https://localhost/にアクセスすると、以下のメッセージが表示されたので、それに従う
Hello! It looks like you were trying to browse to your Chef Server but you haven't installed the Management Console.
If you prefer, you can access the server programmatically with the Chef Server API. To learn how to do this, head over to our API Documentation pages.
If you do want to use your browser to manage your server, then install the Management Console. It's free for up to 25 nodes.
One way to install the Management Console is to log in as root and type these commands:
# chef-server-ctl install chef-manage
# chef-server-ctl reconfigure
# chef-manage-ctl reconfigure
4.上記を実行し、https://localhost/にアクセスすると、コンソールのログイン画面にかわる
get startedを実行し、アカウント情報を入力すると、確認メールが送られる設計となっているが、設定ができてない。
5. adminの登録
chef-server-ctl user-create anagix Joe Anagix support@anagix.com 'xxxxxxxxxxxx' --filename /home/anagix/.chef/anagix.pem
次にorgとvalidatorを作る
chef-server-ctl org-create anagix 'Anagix Corporation' --association_user anagix --filename /home/anagix/.chef/anagix-validator.pem
6.knife.rbの作成
以下の内容で作ってみる
log_level :info
log_location STDOUT
#node_name 'alb.anagix.com'
#client_key '/home/seijirom/.chef/client.pem'
node_name 'anagix'
client_key '/home/anagix/.chef/anagix.pem'
validation_client_name 'chef-validator'
validation_key '/home/anagix/.chef/anagix-validator.pem'
chef_server_url 'https://localhost/organizations/anagix'
7.SSL認証キーの設定
/etc/hosts に 192.168.0.xxx install.anagix.comを追加
別のマシーンで、letsencryptを実行し、install.anagix.com/fullchain1.pemとinstall.anagix.com/privkey1.pem
を/var/opt/opscode/nginx/caにコピーし、install.anagix.com.crtとinstall.anagix.com.keyをシンボリックリンクにする
8.chef-client -c knife.rbを実行
knife ssl check を実行すると、SSLの設定エラー(というかinstall.anagix.comをホスト名にしてないから)が出る。
knife ssl fetchとかして、適当にchef_server_urlをいじって、とりあえずローカルネットでのアクセスはできるようになった
12.19.31