【发布时间】:2016-06-26 10:22:48
【问题描述】:
我正在尝试使用 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:
我可以在机器上手动重启服务
service nginx restart
Redirecting to /bin/systemctl restart nginx.service
如果 Systemctl 管理 nginx 服务,如何通过 chef 重启 nginx 服务?
我还应该创建 init.d 脚本吗?
谢谢
【问题讨论】:
-
什么版本的厨师?它应该在运行输出的顶部告诉您版本。
-
启动 Chef 客户端,版本 11.8.2
-
可以做到,早于自动 systemd 支持。我不记得当时我们是否甚至包括了 systemd 支持。可能最好至少升级到最新的 11.x 版本,但实际上您现在应该升级到 12。
标签: nginx chef-infra cookbook