You're looking for the hiera_include() function, I believe. It's 
undocumented in the official docs, which is a shame, but I'll try to 
describe it.

Your node definition would look something like this:

node default {
  hiera_include('classes')
}

This instructs every node to look up the classes variable in hiera. It 
doesn't *need* to be named classes, but I like that name. This variable 
should evaluate to a list of strings. Each of these strings will then be 
treated as a class name and puppet will attempt to 'include' it. You make 
your hierarchy so that each node gets an appropriate list.

On Tuesday, December 18, 2012 8:29:27 AM UTC-8, Philip Brown wrote:
>
>
>
> On Tuesday, December 18, 2012 7:41:44 AM UTC-8, jcbollinger wrote:
>>
>> The other respondents are right: if you don't want a class assigned to a 
>> node then you should avoid assigning it to the node.  It's pretty silly to 
>> assign it but make that conditionally meaningless.  You don't necessarily 
>> need to pull the logic all the way up to an ENC, but you should pull it up 
>> at least one level.
>>
>>
>>
>>
> The problem is that I have yet to see a solution that is both flexible, 
> and local, for defining which modules get included for a node.
>
> The only thing I've seen so far, are references to things like 
> "Dashboard". Which requires installing a full-on separately running 
> database, blah blah blah.
>
> I was originally hoping that hiera would be able to let me do this, but 
> after learning more about it, it no longer seems to be a good match.
>
> Unless, I suppose, I wrap every individual module in a general node 
> definition with something like
>
> if hiera("load_ntp"){
>    include ntp
> }
> if heira("load_snmp"){
>    include snmp
> }
> if hiera("load_nfsserver"){
>    include nfsserver
> }
>
> And even that has its limits. Heira config matching is fairly dumb. As far 
> as I'm aware, while the top level yaml config can do things like
> ${hostname}.yaml
>
> It cant do things like
>
> if $hostname =~ /.*-db[0-9/     load dbconfigs.yaml
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/2LUhAxczIXoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to