読者です 読者をやめる 読者になる 読者になる

kikukawa's diary

都内で活動するシステムエンジニアが書いてます。 興味を持った技術やハマったポイント、自分用メモをつけてます。 最近はweb中心

apache2のcookbook実行でエラー

berkshelf + chef(knife solo) + httpdで環境構築をしていた際に出てきたエラーです。
cookbookはberkshelfでダウンロードしてきたものです。

〜略〜
==> default: ================================================================================
==> default: Error executing action `enable` on resource 'service[apache2]'
==> default: ================================================================================
==> default: 
==> default: Mixlib::ShellOut::CommandTimeout
==> default: --------------------------------
==> default: Command timed out after 2s:
==> default: Command execeded allowed execution time, process terminated
==> default: ---- Begin output of /usr/sbin/httpd -t ----
==> default: STDOUT: 
==> default: STDERR: 
==> default: ---- End output of /usr/sbin/httpd -t ----
==> default: Ran /usr/sbin/httpd -t returned 
==> default: 
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/apache2/recipes/default.rb
==> default: 
==> default:  24: service 'apache2' do
==> default:  25:   service_name node['apache']['package']
==> default:  26:   case node['platform_family']
==> default:  27:   when 'rhel'
==> default:  28:     reload_command '/sbin/service httpd graceful'
==> default:  29:   when 'debian'
==> default:  30:     provider Chef::Provider::Service::Debian
==> default:  31:   when 'arch'
==> default:  32:     service_name 'httpd'
==> default:  33:   end
==> default:  34:   supports [:start, :restart, :reload, :status]
==> default: 
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/apache2/recipes/default.rb:24:in `from_file'
==> default: 
==> default: service("apache2") do
==> default:   provider Chef::Provider::Service::Systemd
==> default:   action [:enable, :start]
==> default:   supports {:restart=>true, :reload=>true, :status=>true, :start=>true}
==> default:   retries 0
==> default:   retry_delay 2
==> default:   guard_interpreter :default
==> default:   service_name "httpd"
==> default:   pattern "apache2"
==> default:   reload_command "/sbin/service httpd graceful"
==> default:   cookbook_name :apache2
==> default:   recipe_name "default"
==> default:   only_if "/usr/sbin/httpd -t"
==> default: end
==> default: 
==> default: [2014-09-18T22:21:06+01:00] INFO: Running queued delayed notifications before re-raising exception
==> default: [2014-09-18T22:21:06+01:00] ERROR: Running exception handlers
==> default: [2014-09-18T22:21:06+01:00] ERROR: Exception handlers complete
==> default: [2014-09-18T22:21:06+01:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-09-18T22:21:06+01:00] ERROR: service[apache2] (apache2::default line 24) had an error: Mixlib::ShellOut::CommandTimeout: Command timed out after 2s:
==> default: Command execeded allowed execution time, process terminated
==> default: ---- Begin output of /usr/sbin/httpd -t ----
==> default: STDOUT: 
==> default: STDERR: 
==> default: ---- End output of /usr/sbin/httpd -t ----
==> default: Ran /usr/sbin/httpd -t returned 
==> default: FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
〜略〜

コマンドがタイムアウトしているっぽい。
下記ファイルを開いて該当箇所のタイムアウト時間を伸ばして対応しました
cookbooks/apache2/recipes/default.rb

-- only_if "#{node['apache']['binary']} -t", :environment => { 'APACHE_LOG_DIR' => node['apache']['log_dir'] }, :timeout => 2
++ only_if "#{node['apache']['binary']} -t", :environment => { 'APACHE_LOG_DIR' => node['apache']['log_dir'] }, :timeout => 10

他によい方法がありましたらご教授ください。