Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Let's say I have a module with files/etc/foo/{conf0, conf1, conf2, conf3, etc}. It's simple enough to place each of these files when the number of them is small:

file { 'conf0':
    path => '/etc/foo/conf0',
    ensure => true,
    source => 'puppet:///.../etc/foo/conf0',

and repeat. But there's a fair bit of duplication involved, and it's tedious to maintain if there are several configuration files. I would like to ensure that files/etc/foo/ is mirrored onto a given path. That is to say,

file { 'etc foo confs':
   path => '/etc/foo',
   ensure => recursive,
   source => 'puppet:///.../etc/foo',

would create /etc/foo/conf0, /etc/foo/conf1 and so on. Is this possible?

share|improve this question
up vote 12 down vote accepted

Sure - the files type has a recurse option (and recurselimit if you want to limit how deep into the directory it goes).

file { 'etc foo confs':
   path => '/etc/foo',
   source => 'puppet:///.../etc/foo',
   recurse => true,
share|improve this answer
The other thing to keep in mind if doing this is the number of files that Puppet is going to have to maintain connections for. It would not take long to run out of file descriptors and puppet start running into trouble. I've ran into this problem before trying to do this very task. – Jeremy Bouse Oct 20 '11 at 1:13
@JeremyBouse Thank you; that's very useful information. – troutwine Oct 20 '11 at 1:23

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.