====== Chef Workstation ====== ===== Chef Clientインストール ===== gitをインストール # yum install git Gitの確認 $ git --version git version 1.7.1 Chef Clientパッケージをインストール((WorkstationもServerと通信するのでClientが必要です)) # curl -L http://www.opscode.com/chef/install.sh | sudo bash chef-clientコマンドで確認 # chef-client -v Chef: 11.10.4 ===== Cookbook開発環境の構築 ===== Cookbook開発などに利用する[[os:centos#ユーザ追加|ユーザを追加]]して、ホームに.chefディレクトリを作っておく mkdir ~/.chef cd ~/.chef Chef Serverから認証用の秘密鍵((admin.pemとchef-validator.pem))を上で作った.chefディレクトリにコピーする\\ 秘密鍵はChef Serverの/etc/chef-serverにあるadmin.pemとchef-validator.pem chef-repoを作成する $ cd $ git clone git://github.com/opscode/chef-repo.git 作成されたchef-repoディレクトリに移動して、初期設定 $ cd chef-repo/ $ knife configure --initial WARNING: No knife configuration file found Where should I put the config file? [/home/ユーザ名/.chef/knife.rb] Please enter the chef server URL: [https://(localhost名):443] https://(chefサーバのFQDN) 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] /home/ユーザ名/.chef/admin.pem Please enter the validation clientname: [chef-validator] Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] /home/ユーザ名/.chef/chef-validator.pem Please enter the path to a chef repository (or leave blank): /home/ユーザ名/chef-repo Creating initial API user... Please enter a password for the new user: Created user[ユーザ名] Configuration file written to /home/ユーザ名/.chef/knife.rb 確認 $ knife client list chef-validator chef-webui $ knife user list admin ユーザ名 admin.pemは、もう不要なので削除しておく rm ~/.chef/admin.pem ===== 参考 ===== http://www.idcf.jp/blog/cloud/chef-11/ [[http://hivecolor.com/id/46|サーバー構築自動化ツール Chef 最新版のインストール方法]] 1) WorkstationもServerと通信するのでClientが必要です 2) admin.pemとchef-validator.pem