すべてが手探りの環境づくり中。。

なっかなかうまく行かないのと環境のイメージがわかない・・・苦労。。

手順メモ。

********************************
Server側
********************************
■Rubyインストール
RBELリポジトリのインストール
sudo rpm -Uvh http://rbel.frameos.org/rbel6

Rubyとその他開発ツールのインストール
sudo yum install ruby ruby-devel ruby-ri ruby-rdoc ruby-shadow gcc gcc-c++ automake autoconf make curl dmidecode

■RubyGemsインストール(from ソース) ※Ruby言語用のパッケージ管理システム
cd /tmp
curl -O http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar zxf rubygems-1.8.10.tgz
cd rubygems-1.8.10
sudo ruby setup.rb --no-format-executable

■Chefインストール
sudo gem install chef --no-ri --no-rdoc
---(以下がインストールされる)---
Fetching: mixlib-config-1.1.2.gem (100%)
Fetching: mixlib-cli-1.2.2.gem (100%)
Fetching: mixlib-log-1.3.0.gem (100%)
Fetching: mixlib-authentication-1.1.4.gem (100%)
Fetching: yajl-ruby-1.1.0.gem (100%)
Building native extensions. This could take a while...
Fetching: systemu-2.2.0.gem (100%)
Fetching: ohai-0.6.10.gem (100%)
Fetching: mime-types-1.17.2.gem (100%)
Fetching: rest-client-1.6.7.gem (100%)
Fetching: bunny-0.7.9.gem (100%)
[Version 0.7.8] test suite cleanup (eliminated some race conditions related to queue.message_count)
Fetching: json-1.6.1.gem (100%)
Building native extensions. This could take a while...
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: net-ssh-2.1.4.gem (100%)
Fetching: net-ssh-gateway-1.1.0.gem (100%)
Fetching: net-ssh-multi-1.1.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: moneta-0.6.0.gem (100%)
Fetching: highline-1.6.11.gem (100%)
Fetching: uuidtools-2.1.2.gem (100%)
Fetching: chef-0.10.8.gem (100%)
Successfully installed mixlib-config-1.1.2
Successfully installed mixlib-cli-1.2.2
Successfully installed mixlib-log-1.3.0
Successfully installed mixlib-authentication-1.1.4
Successfully installed yajl-ruby-1.1.0
Successfully installed systemu-2.2.0
Successfully installed ohai-0.6.10
Successfully installed mime-types-1.17.2
Successfully installed rest-client-1.6.7
Successfully installed bunny-0.7.9
Successfully installed json-1.6.1
Successfully installed polyglot-0.3.3
Successfully installed treetop-1.4.10
Successfully installed net-ssh-2.1.4
Successfully installed net-ssh-gateway-1.1.0
Successfully installed net-ssh-multi-1.1
Successfully installed erubis-2.7.0
Successfully installed moneta-0.6.0
Successfully installed highline-1.6.11
Successfully installed uuidtools-2.1.2
Successfully installed chef-0.10.8
21 gems installed
---

■Chef Clientの設定
sudo mkdir -p /etc/chef
cd /etc/chef
sudo knife configure client ./

■Chef-Serverのインストール (Chef-Soloを使って)
vim /etc/chef/solo.rb
---
file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"
---

vim ~/chef.json
---(APIのみの場合)---
{
"chef_server": {
"server_url": "http://localhost:4000"
},
"run_list": [ "recipe[chef-server::rubygems-install]" ]
}
---(API+WebUIの場合)---
{
"chef_server": {
"server_url": "http://localhost:4000",
"webui_enabled": true
},
"run_list": [ "recipe[chef-server::rubygems-install]" ]
}
---

sudo chef-solo -c /etc/chef/solo.rb -j ~/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz

chef-soloコマンド実行中のrabbitmq起動でエラーがでた・・・http://matetsu.hatenablog.com/entry/2012/01/11/201609参考に
vim /etc/modprobe.d/ipv6_disable.conf
---
options ipv6 disable=1
---

vim /etc/sysconfig/network
---
NETWORKING_IPV6=no
---
rebootしてもう一度chef-solo~を実施。

多分うまくいくはず。


■サーバ側のclient初期設定
mkdir -p ~/.chef
sudo cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
sudo chown -R $USER:$USER ~/.chef

knife configure -i
---
WARNING: No knife configuration file found
Where should I put the config file? [~/.chef/knife.rb]
Please enter the chef server URL: [http://localhost:4000]
Please enter a clientname for the new client: [tomy] manage-client
Please enter the existing admin clientname: [chef-webui]
Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem] /home/tomy/.chef/webui.pem
Please enter the validation clientname: [chef-validator]
Please enter the location of the validation key: [/etc/chef/validation.pem] /home/tomy/.chef/validation.pem
Please enter the path to a chef repository (or leave blank):
Creating initial API user...
Created client[manage-client]
Configuration file written to /home/tomy/.chef/knife.rb
---

確認1
knife client list

manage-client

確認2
knife client show manage-client
_rev: 1-8978d0e92a50cea4c58dd748df8b833c
admin: true
chef_type: client
json_class: Chef::ApiClient
name: manage-client
public_key: -----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEAsoagHXqUwpuibwFYzPldNIhKvww0JnfJlpsyqd6yRe5CkEAk7mIA
oCvt3mSFkZEESQ+2zBb3zqTMUjk2DTKwdOwYt8MQqNG2jbtH70ipipbAnHb2I/vm
wXj8/4yxsPppWSCguI5XXEFkPCSDy9xWqBkQdgTLPk3OsTMNEoAIiHsNpkdSTv2C
PyHFatUUo13geHpTEbh3oOQB2g6KUBatizKqNB7u5hcbQtRvGbIBir2Y2hB/4+Ym
0JbPsON7AJrYtlbafEJYKAJBDxxZiwG5gV0uS5GASG1NrJwcTojCEWkFdbsQQwi7
oFP42dfEE+/KV2Rkafzb4JIaCpyL3ko2WQIDAQAB
-----END RSA PUBLIC KEY-----


一旦ここまで。