Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a hard time wrapping my head around this. It seems trivial, but I'm not getting it.

I have two files. If either of those two files changes, I want to rebuild one of them.


if file a changes or file b changes
  then file {"a":
           content => template('a.erb', 'b.erb'),

I know I can audit a file for change, I just don't know how to include that within a conditional. Can anyone point me in the right direction?

share|improve this question

You might be able to use notify so it would be like

file {"a": content => template('a.erb'), notify => File["b"], }
file {"b": content => template('b.erb'), notify => File["a"], }

Pretty untested but it should work.. so if b is modified it will re-do b and then send to re-do b also.. but in this small example it isn't needed since puppet will monitor both of those files for changes.

share|improve this answer
Thanks, that gives me something to think about. Specifically what I'm trying to do is to rebuild /etc/passwd if passwd changes or if a file of externally authenticated users changes. The file passwd is built by concatenating the original passwd file with the list of externally authenticated users. – user125540 Jun 21 '12 at 14:38
What is the "original passwd file"? It can't be /etc/passwd, or it would grow recursively. – Antonis Christofides Jul 3 '12 at 15:02
Sorry, should have been more specific. I have file "a" which is the original /etc/passwd after a basic build. I have file "b" which contains a list of externally authenticated users. File "c" is a concatenation of "a" and "b" to form an updated /etc/passwd. If someone mucks with the /etc/passwd file, or the file "b" changes, file "c" is regenerated. – user127961 Jul 11 '12 at 17:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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