hello,
----- "Nat" <[email protected]> wrote:
> 1. an external node classifier with variables passed in the
> parameters section of the YAML to nodes.
> 2. extlookup
> My question is what is the conceptual difference between options
> 1 and 2? is there differences between scope of variables defined
> either way?
with the node tool your essentially defining a whole long list of global
variables and they're available in all classes. You should know upfront all the
variables you need to define and (I think) you dont have a way to access the
facts of the nodes when you're doing the node tool output which makes it hard
to make decisions based on that. It also means your node tool need a lot of
knowledge/logic to set all these variables and defaults etc. I recall
something about facts being passed on STDIN but dont see it in the docs so
maybe i am wrong there and node tools do get access to fact.
with a node tool if you needed to set ntp servers based on country, or facts or
something you basically still need to write a lot of case statements - the
difference is you're just moving this logic driven decision making from puppet
manifests to the external node tool - adding a new site generally either
require code changes or a lot of work in modeling the data.
Foreman does this nicely at the moment with its database structure but you are
restricted to the kinds of data it allows you to model, to model other
relationships would require code changes. (well, till extlookup supports
talking to it anyway then the two would make quite a good combination and any
effort you now put into using extlookup will pay off double then)
With extlookup you set the data requirements where used - in the class - and
where you are looking up the value you can also set a default, with access to
facts:
given the class:
class ntp::config {
file{"/etc/ntp.conf": template("ntp.conf.erb")}
}
looking at this you dont know what's going on, what does the ERB need, what
vars should your node tool pass? it takes a fair bit of digging to know whats
going on - say you're sharing your module with a mate who has his own node tool.
now consider:
class ntp::config {
$ntpserver = extlookup("ntpserver", "${country}.pool.ntp.org")
file{"/etc/ntp.conf": template("ntp.conf.erb")}
}
you look at this and you know what data you can provide - and you already know
it degrades cleanly if you dont set anything sharing this kind of code is much
easier than the other one.
Now your needs change and maybe today you need lookup ability for fqdn, data
center, country tomorrow you might also need one based on customer or even
something weird like time of day. With a node tool as i said you'd need to go
code this in, with extlookup you just configure it in one line of config.
The upcoming puppet feature where you have parameters per class can help with
the discovery phase of what data to pass but i am not sure how/if that
integrates with external nodes, didn't see that mentioned in the release notes
--
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.