On Thursday, August 1, 2013 12:01:28 PM UTC-5, Worker Bee wrote:
>
> Hi Everyone;
>
> First, thanks for your help!
>
> I am trying to create a way to categorize hosts based on both/either/or 
> the name of the host as well as the location of the host.
>
> Right now, I have .pp files that categorize the hosts based on the 
> hostname.  I have written a custom fact to determine the datacenter 
> location but, I cannot figure out how to create .pp files that will allow 
> me to apply catalogs either based on hostname or datacenter name.  
>
> Is there any way to do this outside of hiera or ENC?
>
>

Yes, but much depends on the details.  The simplest -- in principle -- 
direction to go from where you are now would be to write one or more 
classes that encompass the datacenter-specific details, and apply the 
appropriate one of those to each of your nodes in addition to what you are 
applying now.

For instance, if your custom fact $::datacenter may take the values 
'smithville', 'springfield', and 'washington', you might have classes named 
'datacenter::smithville", 'datacenter::springfield' and 
'datacenter::washington', and apply the appropriate one via a declaration 
such as

    include "datacenter::${::datacenter}"

You could put that declaration into each node block or into a single base 
node block that all the others inherit, but if you truly want it applied to 
all nodes then your best bet might be simply to put it at top level in your 
site.pp, outside any node block.


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 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