How to manage mounted partitions (fstab + mount points) from puppet
Solution 1:
You can tell Puppet not to manage a given metaparameter by setting it to undef
.
file { "${location}/${name}":
ensure => directory,
owner => undef,
group => undef,
mode => undef,
selinux_ignore_defaults => true,
}
In this event, if the directory doesn't exist before mounting, it will be created as the user and group which puppetd
was started as (presumably root:wheel) and with a default umask. Puppet won't care about what these are set to at the time of creation or on any subsequent runs.
Alternatively, if you wanted to trade a little complexity for assurance, you could use a custom fact to determine what the active mounts are and a switch statement to set the directory permissions depending on whether it is pre- or post- mounted.
Solution 2:
Not really an answer but this has been fixed in puppet 2.6.7: http://projects.puppetlabs.com/issues/3999
Solution 3:
I have a custom fact (works with Linux only ATM) that will return all the currently mounted local mounts on a system. It's horribly simple, but works for me -- looks like you might find some use for it as well. Anyway, I threw it up on github: https://github.com/justintime/puppet/tree/master/justintime-localmounts