通过厨师在Centos 7上重新启动Nginx服务

我正在尝试使用chef配置nginx服务,但是我得到下面的错误。

Chef::Exceptions::Service
-------------------------
service[nginx]: unable to locate the init.d script!


Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/xxx/recipes/default.rb

 23: service 'nginx' do
 24:   supports :status => true, :restart => true, :reload => true
 25:   action   :enable
 26: end
 27:     

将其复制到答案:

那样做会比自动系统支持早。 我不记得我们是否还包括了当时的systemd支持。 可能最好升级到最新的11.x版本,尽管现在你应该升级到12

您可以尝试将provider Chef::Provider::Service::Systemd到您的service资源中,然后查看是否有效。 如果没有,那么你需要升级。

链接地址: http://www.djcxy.com/p/78313.html

上一篇: Restart Nginx service on Centos 7 via chef

下一篇: Chef recipe fails on service resource