Ask Your Question
0

How to list a group of directories

asked 2013-08-09 15:38:05 -0600

Sheryll_SF gravatar image

updated 2013-08-12 13:56:29 -0600

GregLarkin gravatar image

I want to manage a group of directories whose structure are as such: /u01/userlogs, /u02/userlogs, /u03/userlogs.... etc. I was wondering if I can use /u0*/userlogs inside my manifest instead of listing each directory as below:

ex.

class directory_lists {
   file { '/u01/userlogs':
           ensure => present,
           owner  => root,
           mode   => 755,
         }
   file { '/u02/userlogs':
           ensure => present,
           owner  => root,
           mode   => 755,
         }
}
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-08-12 14:03:09 -0600

GregLarkin gravatar image

Unfortunately, Puppet does not allow that syntax. However, you could create a shell script to mimic what Puppet would do in that situation and call it with an exec resource.

Alternately, you could create a new custom type that does what you want. And if you do, please post it to the Puppet Forge!

edit flag offensive delete link more
0

answered 2013-08-12 15:04:05 -0600

louis gravatar image

Other solution that might help if you have dependencies

$directories = ['/u01/userlogs','/u02/userlogs']
file { $directories: 
   ....
}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-09 15:38:05 -0600

Seen: 61 times

Last updated: Aug 12 '13