0

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.

Essentially:

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?

user9517
  • 115,471
  • 20
  • 215
  • 297

1 Answers1

0

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.

Mike
  • 22,310
  • 7
  • 56
  • 79
  • 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. –  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 03 '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. –  Jul 11 '12 at 17:45