0
這是我非常基本的食譜/ default.rb文件;廚師錯誤在資源服務[httpd]上執行操作`start`
package "httpd" do
action :install
end
node["apache"]["sites"].each do |sitename, data|
document_root = "/content/sites/#{sitename}"
directory document_root do
mode "0755"
recursive true
end
template "/etc/httpd/conf.d/#{sitename}.conf" do
source "vhost.erb"
mode "0644"
variables(
:document_root => document_root,
:port => data["port"],
:domain => data["domain"]
)
notifies :restart, "service[httpd]"
end
end
service "httpd" do
action [:enable, :start]
end
當我在它返回以下錯誤的節點運行廚師客戶端:
Error executing action `start` on resource 'service[httpd]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /sbin/service httpd start ----
STDOUT: Starting httpd: [FAILED]
STDERR: Syntax error on line 15 of /etc/httpd/conf.d/stedelahunty2.conf:
order takes one argument, 'allow,deny', 'deny,allow', or 'mutual-failure'
---- End output of /sbin/service httpd start ----
Ran /sbin/service httpd start returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/apache/recipes/default.rb
35: service "httpd" do
36: action [:enable, :start]
37: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/apache/recipes/default.rb:35:in `from_file'
service("httpd") do
action [:enable, :start]
supports {:restart=>false, :reload=>false, :status=>true}
retries 0
retry_delay 2
default_guard_interpreter :default
service_name "httpd"
enabled true
pattern "httpd"
declared_type :service
cookbook_name "apache"
recipe_name "default"
end
我試圖重新命名它的Apache,使選項更改「:重啓」,完全註釋掉但這意味着httpd無法啓動。我只需要一個簡單的方法在主廚運行完成後重新啓動服務。
再次,道歉的新手問題;我對編碼很陌生。
乾杯
啊好的,所以它將成爲一個基本的Apache服務器,我應該離開哪些選項? – 2015-02-11 07:13:09
對不起,我不知道。你想達到什麼目的,食譜中的'vhost.erb'如何響應。節點上的'/ etc/httpd/conf.d/stedelahunty2.conf'看起來像什麼? – StephenKing 2015-02-11 07:27:48
我複製並從另一個示例粘貼到我的食譜中,它似乎已工作。不幸的是,這並沒有給我知識來修復我的解決方案,但它現在工作。感謝您嘗試提供幫助。謝謝 – 2015-02-11 07:32:54