In Puppet I need to trigger an action if a file resource is changed. I know I can define an exec
resource for the action, and notify that from the file
resoure:
file { '/path/to/myfile':
content => template("${module_name}/mytemplate.erb"),
notify => Exec['my action'],
}
exec { 'my action':
command => '...',
logoutput => true,
}
However, if I do the above, Puppet tries to always apply the exec
resource, not just on file changes. How do I ensure that the action is only triggered when the file is modified?