OOOOPS ! For got one bit that goes in front of the other two lines :
# account creation requires that the homedir directory exists $homedirdir = dirname ( $userhome ) Ignore the comment about the "chgrp" command. I forgot that it is for the parent directory. “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” (Bill Waterson: Calvin & Hobbes) On Oct 13, 2015, at 03:23 PM, Dan White <[email protected]> wrote: Here's a snippet from my user management define that shows how I deal with making a directory that might be many levels deep : # create the homedir-dir exec { "mkdir-${username}": command => "/bin/mkdir -p ${homedirdir} ; /bin/chgrp ${gname} ${homedirdir}", unless => "/usr/bin/test -d ${homedirdir}", require => Group[$gname], } # create the homedir file { $userhome : ensure => directory, require => [ User[$username], Exec["mkdir-${username}"], ] } Note the "chgrp" command stacked in the command line. It did not want to work gracefully in the "file" resource. “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” (Bill Waterson: Calvin & Hobbes) On Oct 13, 2015, at 01:20 PM, Ugo Bellavance <[email protected]> wrote: Hi, I'd need to create a number of directories in a fasion similar to that: /var/extlogs/$stage/$client-$application For example, if stages are integration, staging, production and clients are client1 and client2 (there are many morem in reality), I'd like to have puppet create /var/extlogs/integration/client1-application1 /var/extlogs/integration/client1-application2 /var/extlogs/integration/client2-application1 /var/extlogs/integration/client2-application2 /var/extlogs/staging/client1-application1 /var/extlogs/staging/client1-application2 /var/extlogs/staging/client2-application1 /var/extlogs/staging/client2-application2 /var/extlogs/production/client1-application1 /var/extlogs/production/client1-application2 /var/extlogs/production/client2-application1 /var/extlogs/production/client2-application1 I've created a class that eases the job: define lsyncd::createdestdirs ( $application = '', $client = '', $envstage = '', ) { file { '/var/extlogs': ensure => directory, owner => "root", group => "root", mode => 0755, } file { "/var/extlogs/${envstage}": ensure => directory, owner => "root", group => "root", mode => 0755, require => File['/var/extlogs'], } file { "/var/extlogs/${envstage}/${client}-${application}": ensure => directory, owner => "root", group => "root", mode => 0755, require => File["/var/www/extlogs/${envstage}"], } } I can simply call something like lsyncd::createdestdirs { 'client1-application1': application => 'application1', client => 'client1', envstage => 'production', } to create one directory, but would there be a way to have all the directories created in one directive, by setting $application, $client, and $stage in an array? I'm currently using puppet 2.7.25 and I'm not using hiera or puppetdb. Thanks, Ugo -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c9182f72-ae82-4a89-95e1-e297dc74aa5a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/daee2259-55a9-47f2-8483-e2b6610a76cd%40me.com. For more options, visit https://groups.google.com/d/optout.
