1
votes

I'm deploying a package that requires a template be created in a specified directory every time a directory is unzipped.

A remote_file notifies my unzip action, that unzip action notifies the template resource, which in turn notifies other resources. This chain of notifications works as expected.

Below is my template resource:

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

My question: Is there a way to have the template resource execute if I make a change to the source template? Right now it only executes the template resource if notified by my unzip action (due to my action :nothing).

However, it would be great to have a way for it to tell if the template itself has changed. Perhaps some kind of not_if or only_if statement?

1

1 Answers

0
votes

sounds to me that you avoid all the notification chaining if you will have your resources defined in the same recipe.

back to your questions, it sounds that setting action :create, which is the default action, will do the trick. from the template resource documentation

action :create

Create a file. If a file already exists (but does not match), update that file to match.