On 12/9/15 9:08 AM,
ddn...@gmail.com wrote:
> Hello Group,
>
>
> I am working on a module to handle mounting of NFS mounts.
> *Puppet*: 3.7.1
> *Hiera*: 1.3.4
>
> I have already tested it in my lab machine and it works as expected:
>
> mytestserver.example.com.yaml
> |
> nfsmounts:
> '/net1':
> path:'/net1'
> device:'somefiler:/vol/vol1/test1'
> '/net2':
> path:'/net2'
> device:'nfsserver:/data/test2'
> '/net3':
> path:'/net3'
> device:'192.168.0.100:/local/foo/test3'
> |
>
>
> init.pp
> |
> classmynfsmounts {
> $nfsmounts_hash =hiera_hash('nfsmounts')
> create_resources('mynfsmounts::mounts',$nfsmounts_hash )
> }
> |
>
> mounts.pp
> |
> define mynfsmounts::mounts ($path,$device,)
> {
> $mountopts ='rw,_netdev'
> $owner ='admuser'
> $group ='admuser'
>
> mount {$name:
> ensure =>'mounted',
> device =>$device,
> fstype =>'nfs',
> options =>$mountopts,
> atboot =>'yes',
> require =>File[$title],
> }
>
> file {$title:
> ensure =>directory,
> owner =>$owner,
> group =>$group,
> mode =>'2775',
> }
>
> }
> |
>
>
> My question is, how do I separate the /file/ and the /mount/ resources
> in a separate manifest inside the same module and have the same effect?
> Our puppet admins require that defined type declarations do not include
> resources inside them.
>
Hi,
Checkout ghoneycutt/nfs[1], it already supports a ton of platforms,
though if yours is not supported, I would be happy to work with you to
add support.
If you want to also ensure the directory is there for the mount, I use
ghoneycutt/types[2], which supports NFS and more. An example is here[3].
Like Martin, I'm also a bit confused by your statement regarding the
puppet admins. Hopefully they are encouraging the use of third party
modules as opposed to reinventing the wheel. :) The code you have makes
sense to me, whereas putting the mount and file resources somewhere else
does not make sense at all and seems to be in opposition to why defined
types exist.
[1] -
https://github.com/ghoneycutt/puppet-module-nfs
[2] -
https://github.com/ghoneycutt/puppet-module-types
[3] -
https://github.com/ghoneycutt/puppet-module-types#mount
Best regards,
-g
--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile:
+1.206.414.8658