On 9/22/16 6:54 AM, otheus uibk wrote:
> Chiming in...
>
> The old feature request at https://projects.puppetlabs.com/issues/4815
> <https://projects.puppetlabs.com/issues/4815> had it right. This should
> be a part of the core Mount resource type. Eric's rejection of it was
> stupid. On most systems, when you mount a volume, the underlying file or
> directory must first be there. After you mount, the permissions of the
> mounted directory may need to be changed for whatever reason. In another
> thread, it was argued that the underlying filesystem -- if it's NFS --
> should have the permissions set on the server; that's a silly argument,
> but more importantly, the underlying filesystem might be a newly created
> one at the time of deployment. So either before or after, a File
> resource is needed. Actually, both, but because we can't define the same
> resource twice, we have to choose one. And because the alternative
> currently seems to be an Exec resource, the solution is system
> dependent. (Or, we have to go through a lot of trouble).
>
> The following is an ugly hack, and must be tweaked for each system. This
> example works for linux:
>
> mount { 'fs:/mountpoint':
> name=> '/mountpoint',
> device=> 'fs:/vol/devid',
> ensure=> mounted,
> require=> Exec[mount-ensure-mountpoint],
> ...
> }
> file { '/mountpoint':
> # After mountpoint has been created
> owner=> newownerid,
> group=> newgroupid,
> mode=> '0770'
> require=> 'Mount[fs:/mountpoint]',
> }
> exec { 'mount-ensure-mountpoint'
> command=> 'mkdir -p m 0755 /mountpoint',
> creates=> '/mountpoint'
> }
>
> I suppose a refreshonly => true in the Exec resource might provide a
> tiny optimization.
> Creating a custom type or function to do the above is silly, given that
> nearly every systemadmin needs.
>
> I cannot currently figure out PUppetlabs' new issue tracking/search
> system, otherwise I would try to add this to a ticket there.
>
Hi,
You can use ghoneycutt/types, which has a class for mount[1]. It ensures
the directory exists for the mount by using `mkdir -p`.
You can use it directly from Hiera as per the docs or through a manifest
like this.
types::mount { '/srv/nfs/home':
ensure => 'present',
device => 'nfsserver:/export/home',
fstype => 'nfs',
options => 'rw,rsize=8192,wsize=8192',
}
[1] - https://github.com/ghoneycutt/puppet-module-types#mount
Best regards,
-g
--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658
--
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/35d475fa-e4df-8b84-8682-ce7c8d6ae542%40garretthoneycutt.com.
For more options, visit https://groups.google.com/d/optout.