Hello stdlib package has a function ensure_resource that would allow you to create the directory as many times as needed.
out of curiosity why not use the puppetlabs apache module? Cheers Neil On 7 Jul 2017 09:39, "'Bas van de Wiel' via Puppet Users" < [email protected]> wrote: > So I managed to hack a fix for this: > # Hackish pair of execs to allow multiple sites with the same docroot > # See: https://confluence.maxserv.com/display/OPS/MaxServ+Apache > exec { "${name}_${webroot}": > cwd => '/', > user => 'root', > path => '/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/ > sbin:/usr/local/bin:/home/beheer/bin', > command => "`which mkdir` -p ${webroot}", > creates => $webroot, > notify => Exec["${name}_webroot_permissions"], > } > > exec { "${name}_webroot_permissions": > cwd => '/', > user => 'root', > path => '/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/ > sbin:/usr/local/bin:/home/beheer/bin', > command => "`which chown` ${apache::user}:${apache::group} > ${webroot}", > refreshonly => true, > } > > Any comments? > > Bas > > On 06-07-17 21:32, bas via Puppet Users wrote: > > Hello Puppet users, > > I'm working on a webserver module that needs to ensure directories for > document roots. I tried doing this by using file resources like so: > > file { 'vhost-A': > ensure => 'directory', > path => '/var/www/sharedvhost', > ...clipped for brevity... > } > > file { 'vhost-B': > ensure => 'directory', > path => '/var/www/sharedvhost', > ...clipped for brevity... > } > > This, sadly, does not work. Even though I avoid the pitfall of declaring > two resources by the same name Puppet is clever enough to see that I'm > ensuring the same path in the end. > > What I'd like the result to be, is the existence of /var/www/sharedvhost > with the ability for my vhost resource type to know about it but without > throwing errors. > > Any help would be much appreciated! > > Bas > > > -- > 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/fbdc265c-4fe1-59b3-fb07-c951abe957d6%40area536.com > <https://groups.google.com/d/msgid/puppet-users/fbdc265c-4fe1-59b3-fb07-c951abe957d6%40area536.com?utm_medium=email&utm_source=footer> > . > 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/CAAohVBcj7CE4_M_y_%2B5wM06Bz26w5tvskmReXNEJZOWdYhMqMw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
