概要
timezoneの設定用cookbookの作成
詳細
timezoneの設定のためのcookbookを作成します。
cookbook
/files/default/timezone
Asia/Tokyo
/library/helper.rb
class Chef class Recipe def execute_with_log(name, &block) log "start #{name}" block.call log "end #{name}" end end end
/recipe/default.rb
# # Cookbook Name:: timezone_ja # Recipe:: default # # Copyright 2013 # execute_with_log("update timezon file to japanese settings") do cookbook_file "/etc/timezone" do source "timezone" owner "root" group "root" end end execute_with_log("dpkg-reconfigure") do bash "dpkg-reconfigure" do code <<-EOS sudo dpkg-reconfigure --frontend noninteractive tzdata EOS end end