似たようなことを沢山
template '/etc/php.d/hogehoge' do
source'php.d/hogehoge.erb'
end
template '/etc/php.d/piyopiyo' do
source 'php.d/piyopiyo.erb'
end
template '/etc/php.d/mogemoge' do
source 'php.d/mogemoge.erb'
notifies :restart, 'service[php-fpm]' if notifiles ## これだけデーモン再起動
end
4
Thursday, September 19, 13
5.
libraries/default.rbに書いて
def template_for_php(dir, file,notifiles = false)
template ::File.join(dir,file) do
source [file, 'erb'].join('.')
mode '0644'
notifies :restart, 'service[php-fpm]' if notifiles # 引数で指定
end
end
5
Thursday, September 19, 13
ログに出すコードサンプル
solo.rbでもレシピ内でもOK
require 'chef/handler'
class Chef::Handler::LogReport< ::Chef::Handler
def report
Chef::Log.warn '======= Update Resources are following...'
data[:updated_resources].each.with_index do ¦r,idx¦
Chef::Log.warn [idx, r.to_s].join(':')
end
end
end
Chef::Config[:report_handlers] << Chef::Handler::LogReport.new
17
Thursday, September 19, 13
issueの切りグセがあれば
Rubygemsのリリースノートにも載れる
=== 2.1.1 /2013-09-10
Bug fixes:
* Only matching gems matching your local platform are
considered for
installation. Issue #638 by José M. Prieto, issue #639 by
sawanoboly.
37
Thursday, September 19, 13