我有一个应该安装模板的配方,然后重启服务......
service "rsyslog" do
supports :restart => true, :reload => true
action [:enable, :start]
end
Chef::Log.info("Creating loggly rsyslog conf")
template "/etc/rsyslog.d/22-loggly.conf" do
source "syslogd.conf.erb"
mode "0755"
owner "root"
group "root"
notifies :restart, resources(:service => "rsyslog")
end
为什么我会:
ERROR: resource template[/etc/rsyslog.d/22-loggly.conf] is configured to notify resource service['rsyslog'] with action restart, but service['rsyslog'] cannot be found in the resource collection. template[/etc/rsyslog.d/22-loggly.conf] is defined in /home/ubuntu/cookbooks/loggly-syslog/recipes/default.rb:7:in `from_file'
[2014-01-03T23:26:37+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
添加配置文件后,如何重新启动/重新加载rsyslog?
答案 0 :(得分:4)
您使用的是旧通知语法。切换到新语法:
template '...' do
notifies :restart, 'service[rsyslog]'
end