͚ͬ͜͏͍ܰ
$ time sudo chef-solo -c solo.rb -j node.json
Recipe: hello::default
* execute[echo Hello] action run
- execute echo Hello
1.70s user 0.74s system 71% cpu 3.414 total
$ time itamae local hello/recipes/default.rb
INFO : Recipe: /private/tmp/...
INFO : execute[echo Hello]
INFO : action: run
0.33s user 0.12s system 87% cpu 0.516 total
# ͜ͷ߹ɺItamaeOhaiΛୟ͍ͯͳ͍ͷͰͪΐͬͱνʔτͬΆ͍
15
no#fies
Ϧιʔε͕ߋ৽͞Εͨʢύοέʔδ͕Πϯετʔϧ
͞ΕͨɺͳͲʣ߹ʹɺଞͷϦιʔεͷΞΫγϣϯ
Λ࣮ߦ͢Δ
service "nginx"
template "/etc/nginx/conf.d/site" do
source "nginx/site.erb"
notifies :reload, "service[nginx]"
end
24
Slide 25
Slide 25 text
subscribes
ଞͷϦιʔε͕ߋ৽͞Εͨʢύοέʔδ͕Πϯε
τʔϧ͞ΕͨɺϑΝΠϧ͕ॻ͖Θͬͨetc.ʣ߹
ʹɺΞΫγϣϯΛ࣮ߦ͢Δ
service "nginx" do
subscribes :reload,
"template[/etc/nginx/conf.d/site]"
end
template "/etc/nginx/conf.d/site" do
source "nginx/site.erb"
end
25
Slide 26
Slide 26 text
defini&on
ෳͷϦιʔε͔Β৽͍͠ϦιʔεΛఆٛ͢Δ
define :install_and_enable_package, version: nil do
package params[:name] do
version params[:version] if params[:version]
action :install
end
service params[:name] do
action :enable
end
end
install_and_enable_package 'nginx' do
version '1.6.1'
end
26