Chef ServerとChef Workstationを同一サーバに導入

一応メモ。

OS: CentOS 6.5 (final) minimal

Chef Server

URLは公式のをコピペ。

# rpm -ivh https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-server-11.0.10-1.el6.x86_64.rpm
(略)
########################################### [100%]
Thank you for installing Chef Server!

The next step in the install process is to run:

sudo chef-server-ctl reconfigure

/etc/hosts にIPアドレスとホスト名を書いておく。

# chef-server-ctl reconfigure
(略)
Chef Client finished, 268 resources updated
chef-server Reconfigured!

これで https://(ホスト名)/ でweb-uiにアクセスできるはず。

Chef Workstation

# yum install git

Chef Clientパッケージのインストール

# curl -L http://www.opscode.com/chef/install.sh | bash
(略)
Thank you for installing Chef!

バージョン確認

# chef-client -v
Chef: 11.8.2

configureのテスト

# chef-server-ctl test
Configuring logging...
Creating platform...
Starting Pedant Run: 2014-01-15 05:44:39 UTC
setting up rspec config for #<Pedant::OpenSourcePlatform:0x00000000fe5678>
Configuring RSpec for Open-Source Tests
 _______  _______  _______  _______  _______  ______   _______
|       ||       ||       ||       ||       ||      | |       |
|   _   ||    _  ||  _____||       ||   _   ||  _    ||    ___|
|  | |  ||   |_| || |_____ |       ||  | |  || | |   ||   |___
|  |_|  ||    ___||_____  ||      _||  |_|  || |_|   ||    ___|
|       ||   |     _____| ||     |_ |       ||       ||   |___
|_______||___|    |_______||_______||_______||______| |_______|

     _______  _______  ______   _______  __    _  _______
    |       ||       ||      | |   _   ||  |  | ||       |
    |    _  ||    ___||  _    ||  |_|  ||   |_| ||_     _|
    |   |_| ||   |___ | | |   ||       ||       |  |   |
    |    ___||    ___|| |_|   ||       ||  _    |  |   |
    |   |    |   |___ |       ||   _   || | |   |  |   |
    |___|    |_______||______| |__| |__||_|  |__|  |___|

                    "Accuracy Over Tact"

                  === Testing Environment ===
(略)

Finished in 51.72 seconds
70 examples, 0 failures

ここで 0 examples, 0 failures となっているとどこか間違っている。/etc/hostsの記載漏れとか。

cookbook開発準備

面倒くさいのでrootで…。

# cd
# mkdir .chef
# git clone git://github.com/opscode/chef-repo.git

何も書いてないところはEnter。

# knife configure --initial
WARNING: No knife configuration file found
Where should I put the config file? [/root/.chef/knife.rb] 
Please enter the chef server URL: [https://chef:443] https://ホスト名:443
Please enter a name for the new user: [root]
Please enter the existing admin name: [admin]
Please enter the location of the existing admin's private key: [/etc/chef-server/admin.pem]
Please enter the validation clientname: [chef-validator]
Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem]
Please enter the path to a chef repository (or leave blank): /root/chef-repo
Creating initial API user...
Please enter a password for the new user: 任意のパスワード
Created user[root]
Configuration file written to /root/.chef/knife.rb