3
我很新Chef
。我有一个配方,安装sendmail
,它做我的配置。我注意到,Chef
每次运行都会重新启动服务。这是因为我正在运行调用会话重新启动的execute
。厨师执行块
它看起来像这样:
execute "hashAccess" do
command "makemap hash /etc/mail/access < /etc/mail/access"
notifies :restart, "service[sendmail]"
end
我需要的,如果更新了access
文件时才会调用它。
template "/etc/mail/access" do
source "access.erb"
mode "0644"
notifies :run, "execute[hashAccess]"
end
当文件更新时,execute
被调用两次。 两种资源都在相同的配方,当我尝试define
hashAccess
我得到一个错误
ERROR: Cannot find a resource for define on amazon version 2013.09
如何使执行资源仅调用时运行?
谢谢!我知道它会很简单... :) –
谢谢@Draco Ater – Robert