Thank you guys, I have figured it out.

I am defining all shares in one file and introducing 1 extra argument which
tells if share enable/disabled.(all disabled by default)

In my defined resource I am doing one more hiera lookup for this argument
"hiera("nfs_mount::${name}")"  and if true - use create_resources.

This way I have 1 file in hiera with all definitions + nfs_mount::${name}:
true  define per host basis for servers where I need share this mounted.


The thing is - that was my initial plan to do, but I kept getting "resource
already defined" when multiple shares existed with the same mountpoint name.

Looks like it was happening due to the incorrect layout I have created in
hiera(I have assigned "name" of the resource to be the same as the mount
point). Now I have changed this and all works as expected.

it used to be:
nfsshares:
  share1:
    name: /mnt
  share2:
    name: /mnt

Changed to:

nfsshares:
  share1:
    dir: /mnt
  share2:
    dir: /mnt

Regards,
Andrey





Andrey








On 15 January 2014 07:29, Andrey Kozichev <[email protected]> wrote:

> Thanks for the link. I will have a look.
> On 15 Jan 2014 04:16, "Garrett Honeycutt" <[email protected]> wrote:
>
>>
>>
>> On Monday, January 13, 2014 9:38:33 PM UTC-5, ianm wrote:
>>>
>>> On 14/01/14 03:49, Andrey Kozichev wrote:
>>>
>>> > 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?
>>>
>>> If in hiera you define a hash of hashes (instead of an array of hashes)
>>> you can pass that to create_resources which will create a resource for
>>> each hash.
>>>
>>>
>>
>>> --
>>> Ian
>>>       [email protected]     Ian Mortimer
>>>       Tel: +61 7 3346 8528     Science IT
>>>                                University of Queensland
>>>
>>
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-users/3741b3dd-0dbb-4c29-8d58-06250344289e%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>

-- 
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/CACzr%3DFeHrtyhJmVmCs0OCngETAyfG0_bF%2BqFC5WwCKHdHJ2tzw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to