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
 On 14 Jan 2014 23:16, "jcbollinger" <[email protected]> wrote:

>
>
> On Tuesday, January 14, 2014 6:37:56 AM UTC-6, Andrew wrote:
>>
>> can't seem figure this out.
>> Here is my data:
>>
>> common.yaml
>>
>> 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.
>>
>
>
> I'm not altogether clear on what you do or don't want to do, but your data
> appear to be pointing in this direction:
>
> class nfs::client (
>     $nfs_resource_name
>     ) {
>   nfs::share { ${nfs_resource_name}:
>     sharedata => hiera('nfsshares')
>   }
> }
>
> define nfs::share (
>     $sharedata
>     ) {
>   $my_data = { $title => $sharedata[$title] }
>   create_resources('mount', $my_data)
>
>   # if you don't want to use create_resources()
>   # then you can put a regular mount declaration
>   # there.  It only needs to handle one resource.
> }
>
> I'm assuming there that you must accommodate cases where the 'nfsshares'
> data contains more shares than you want to declare for the given node, else
> create_resources() could more directly be applied to the problem.
>
> Alternatively, you could write a custom function that creates a hash
> containing just the wanted elements by selecting elements from the overall
> hash based on array of keys.  You could use create_resources() directly on
> that without an intervening defined type. Such a function would be
> sufficiently general to be reusable, and it could be expressed very
> compactly in Ruby.
>
>
> John
>
>  --
> 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/c816acf4-26df-4a6d-881c-ed15457eb10a%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%3DFcYPGji-Ujfm4BHsqL0rk6HOZPPOS5uoXcFs1VO6uPe0g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to