I am trying to make sure a directory exists for a mount and then also update the permissions of that directory after the mount happens. I am receiving the following error:
err: Failed to apply catalog: Cannot alias File[pre_eos_mount] to ["/var/tmp/eos"] at /etc/puppet/modules/mymodule/manifests/eos.pp:29; resource ["File", "/var/tmp/eos"] already declared at /etc/puppet/modules/mymodule/manifests/eos.pp:47
I would like to do something like this:
file { $eos_mount : ensure => 'directory', mode => '1777', owner => 'root', group => 'root', } mount { $eos_mount : ensure => 'mounted', device => $lv_device, fstype => $fstype, options => 'defaults,noatime,nodiratime', require => File[$eos_mount], notify => File['post_eos'], } file { 'post_eos' : path => $eos_mount, ensure => 'directory', mode => '1777', owner => 'root', group => 'root', } What is a way to ensure permissions of a folder after it has been mounted?
execresource with a command ofmkdir -p $eos_mount, which would just create the directory if it didn't already exist?execis a hack, but it's the only way to do it besides running Puppet multiple times. Puppet doesn't provide a way to apply the same resource from the catalog multiple times, even in different run stages.