Hello,
> We are using Puppet to manage hosts on our network at work, and one
> aspect that is causing me some cognitive discomfort is the question:
>
> How to best manage location-specific configuration
The way I generally deal with this is with a parser function[1] that look up
data elsewhere, outside of puppet, I can set up my environment via site.pp as
follows:
$extlookup_datadir = "/etc/puppet/manifests/extdata"
$extlookup_precedence = ["%{fqdn}", "location_%{location}", "domain_%{domain}",
"common"]
And in my manifests I have something like:
$nameserver = extlookup("resolver_nameservers")
$search = extlookup("resolver_search")
What this does it check if I have these variables set for ${fqdn} if its not
there then for location_${location} and so forth, finally falling back to a
one-size-fits-all answer in the common data source, and if its not there then
its a parser error and the manifest wont run.
This effectively replaces:
case $location {
"londonixn": {
$nameserver = "1.1.1.1"
$search = "foo.com"
}
"hetznerde": {
}
}
style constructs with simple external data sources. I have machines in around
10 locations now so the whole case statement thing was driving me mad so it's
massively simplified my life. Currently I use CSV files for the data sources,
of course you can use databases or whatever and this whole thing lends it self
great to be a web UI.
[1] http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions
--
R.I.Pienaar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
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
-~----------~----~----~----~------~----~------~--~---