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