Could you maybe use "mgmtnfs-${environment}-${fqdn}" (or add more unique-ish suffix strings) in the resource title? If I recall correctly giving each resource a unique title will ensure that each server+environment's mount is a uniquely named resource.
Possibly I'm getting closer?
Hi All,
So here's my use case:
I've got an application with multiple environments, say live, qa and dev, and each environment has multiple servers. The actual application requires an NFS mount mounted on each of these servers. Each environment has it's own NFS drive.
I also have a management server which needs to mount all these NFS drives of every environment.
I use a mount resource included on each environment server to mount each NFS drive, with the help of an $environment variable, which points it to the right share on the NFS server, which is all working fine.
Now I want to puppetize the mounts of all NFS shares on the management server as well, so I thought of using something like this in the actual environment server manifest:
@@mount { mgmtnfs-$environment:
name => "/$path-$environment"
fstype => "nfs"
}
and I wanted to collect that in the management server manifest with
Mount <<||>>
Problem is that each exported resource must be globally unique across every single node, not for every environment. That means that if two servers export this resource to the same nfs mount I'll get an error. I don't want an individual nfs mount on the mgmt server per node, but per environment. So I can't use $host instead of $environment
types::mounts: /srv/nfs/home: device: nfsserver:/export/home fstype: nfs options: rw,rsize=8192,wsize=8192
Hello guys,
I am working on similar task.
Trying to find the way to define all NFS shares somewhere in the high level of hierarchy and then just add/remove them on the node level just by name.
So I am using the class which accepts mountpoint names, then I want to do hiera lookup for each name to expand all the options of the mountpoint and create resources based on that.
This scenario works well if on the class input I just supply single mountpoint -> then I do hiera("mountpointname") and create_resources()
But if I want to have multiple Mountpoints defined per host I need to supply an Array to the class and then iterate it and fetch details for each mountpoint. I can probably do this by using new 3.2 syntax with "each", but I would like to avoid this.
Do you have any better way to implement this?
My target is to define Mountpoints in single place in Hiera and then use it for different hosts using Hiera.
Andrey
nfsshares:
"nfsshare-public":
name: /var/public
device: "hostname1:/vol/public"
remounts: true
options: 'rw,bg,hard'
"nfsshare-private":
name: /var/private
ensure: mounted
device: 'hostname2:/var/private'
remounts: true
options: 'rw,bg,hard'
now on the node level:
my-test-server.yaml
nfs::client::nfs_resouce_name: [ 'nfsshare-public', "nfsshare-private" ]
struggling to make class "nfs::client"
to create resources 'nfsshare-public', "nfsshare-private" based on the above data in hiera without making "create_resources" inside of "create_resources" or run loop on nfs_resouce_name and then create_resource for each item.
There must be simpler way.
Any hints appreciated.
Andrey
Andrey
--
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 puppet-users+unsubscribe@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/52D4A329.9000608%40uq.edu.au.
can't seem figure this out.Here is my data:common.yamlnfsshares:
"nfsshare-public":
name: /var/public
device: "hostname1:/vol/public"
remounts: true
options: 'rw,bg,hard'
"nfsshare-private":
name: /var/private
ensure: mounted
device: 'hostname2:/var/private'
remounts: true
options: 'rw,bg,hard'
now on the node level:
my-test-server.yaml
nfs::client::nfs_resouce_name: [ 'nfsshare-public', "nfsshare-private" ]
struggling to make class "nfs::client"
to create resources 'nfsshare-public', "nfsshare-private" based on the above data in hiera without making "create_resources" inside of "create_resources" or run loop on nfs_resouce_name and then create_resource for each item.
There must be simpler way.
Any hints appreciated.
Thank you John, it looks like what I need.
I was doing something similar but was getting an error on create_resource, I think I see now what was wrong. I will try this.
Andrey
--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c816acf4-26df-4a6d-881c-ed15457eb10a%40googlegroups.com.
Thanks for the link. I will have a look.
On Monday, January 13, 2014 9:38:33 PM UTC-5, ianm wrote:
I have this implemented[1] such that you define a hash of your mounts somewhere in Hiera. If you want to do a merge lookup against Hiera so that if you specify the hash at multiple levels it gets all that it matches (ie: fqdn, profile and environment levels), you can do this by setting nfs::hiera_hash: true
[1] - https://github.com/ghoneycutt/puppet-module-nfs
--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3741b3dd-0dbb-4c29-8d58-06250344289e%40googlegroups.com.
hiera hash with each environment and its associated mount point
hiera lookup on a non-management node grabs its environment
environment is used to determine which mount point via hiera_hash
management node uses create_resources and hiera_hash to make its mount points