On Tuesday, August 27, 2013 7:26:41 PM UTC-5, François Lafont wrote:

>
> I thought about another way with the extlookup function. 
>
> --- 
> snmp: 
>  community: extvalue_community 
>
> monitoring: 
>  community: extvalue_community 
>
> And in a common.csv file: 
>
> extvalue_community,abcd1234 
>
> Then: 
>
> class snmp { 
>
>     $snmp      = hiera_hash('snmp') 
>     $community = extlookup($snmp['community']) 
>     
>     # and the rest of the class... 
>
> } 
> class monitoring { 
>
>     $monitoring = hiera_hash('monitoring') 
>     $community  = extlookup($monitoring['community']) 
>
>     # and the rest of the class... 
>
> } 
>
> I don't know if it's good method. 
>
> Thanks for your help John. 
>
> -- 
> Francois Lafont 
>

I think you're taking an extra step and arriving at the same solution. 
 Eliminate the extlookup step and instead have both modules look at the 
same variable in hiera. Make it some arbitrary name that doesn't conflict 
with any module (and hopefully won't in the future either).  Then just 
lookup that value explicitly with the hiera function in any module that 
needs it.

--- 
snmp_community: abcd1234

class snmp { 
    $snmp_community      = hiera('snmp_community') 
}

class monitoring {
    $snmp_community      = hiera('snmp_community')
}

If you do use a hash like you were using in Hiera, please note that you do 
not need to use hiera_hash() to get the data unless you're "merging" that 
hash up your hierarchy (i.e. Setting part of the hash data in global and 
setting some more pieces of the hash in another part of the hierarchy that 
you want to merge together for the final data).  hiera() will get the hash 
just fine but will not merge it up the tree.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to