1

I have a scenario wherein i have 5 template files that needs to be copied to the puppet agent machine. And i want to notify an exec resource if there is a change in any one of the template files. But the exec resource have to be called only once. That is, if there is a change in 2 or more files, then the exec resource have to be called only once. I tried googling but couldn't find a way to achieve the same. Any ideas?

1

This is the normal behaviour.
Every resource is only executed once.

For example here:

exec { 'foo':
  command     => '/bin/echo x >> /tmp/foo',
  refreshonly => true,
}

file { '/tmp/a':
  ensure => file,
  notify => Exec['foo'],
}

file { '/tmp/b':
  ensure => file,
  notify => Exec['foo'],
}

The exec will only run once, even if both /tmp/a and /tmp/b do not exist.

But also note that the exec here will not run at all if both /tmp/a and /tmp/b do exist (due to the refreshonly => true parameter).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.