【发布时间】:2019-04-20 03:12:31
【问题描述】:
我正在部署一个包,每次解压缩目录时都需要在指定目录中创建一个模板。
remote_file 通知我的解压缩操作,该解压缩操作通知模板资源,而模板资源又通知其他资源。此通知链按预期工作。
下面是我的模板资源:
template 'C:\\Program Files\\MyProgram\\program.yml' do
source "my_program-#{node['program']['version']}.yml.erb"
action :nothing
notifies :run, 'powershell_script[install-program]', :immediately
end
我的问题:如果我对源模板进行更改,有没有办法让 template 资源执行?现在它只在我的解压缩操作通知时才执行template 资源(由于我的action :nothing)。
但是,如果有一种方法可以判断模板本身是否已更改,那就太好了。也许某种not_if 或only_if 声明?
【问题讨论】:
标签: ruby chef-infra cookbook