では、ここまでの話を踏まえて、実際に Cookbook を作ってみてください。
作成するのは Jenkins をインストールする Cookbook です。
継続的インテグレーションツールです。
http://jenkins-ci.org/
もともとは一般的な製品(ソースコード)を対象にしたツールでしたが、
最近では Kitchen や Serverspec といった技術が出てきていて、Jenkins と組み合わせた「インフラCI」や「テスト駆動インフラ」が盛り上がってきています。
http://pkg.jenkins-ci.org/redhat/ から rpm をダウンロード
ダウンロードした rpm を yum コマンドでインストール
/etc/sysconfig/jenkins を編集して、実行ユーザーを変更
利用するディレクトリのオーナーを変更
サービスを登録・起動
execute Resource [ http://docs.opscode.com/resource_execute.html ]
remote_file Resource [ http://docs.opscode.com/resource_remote_file.html ]
※ ダウンロードしたファイルなどは /tmp ではなく Chef::Config[:file_cache_path] に保存する
package Resource [ http://docs.opscode.com/resource_package.html ]
ruby_block Resource [ http://docs.opscode.com/resource_ruby_block.html ]
Chef::Util::FIleEdit [ http://rubydoc.info/gems/chef/Chef/Util/FileEdit ]
※ execute Resource で sed コマンドを実行してもよい
※ file Resource + lazy でもできるかな?
ruby_block Resource [ http://docs.opscode.com/resource_ruby_block.html ]
FileUtils#chown_R [ http://docs.ruby-lang.org/ja/1.9.3/method/FileUtils/m/chown_R.html ]
※ execute Resource で chown コマンドを実行してもよい
service Resource [ http://docs.opscode.com/resource_service.html ]