Miguel Armas writes:
> 2009/12/1 Ohad Levy <[email protected]>:
> > Hi,
> >
> > Why not use cobbler external nodes feature to avoid all of this all
> > together
>
> Because right now only some nodes will use cobbler, I already have
> >250 hosts and I don't want to change all my setup
We recently set up Cobbler but have only some of our hosts installed via
the Cobbler environment. The other hosts configured in Puppet still use
the somewhat old-fashioned nodes.pp and templates.pp setup, i.e. a
nodes.pp with lines like "node somehost inherits t_somehost {}" and a
templates.pp with "node t_somehost { include someclass }" entries.
Fortunately Puppet seems to be nice about merging information from both
Cobbler and nodes/templates, and for now I have a simple shell script as
a node classifier that pulls information from Cobbler. Currently we use
only the "Kickstart metadata" which Cobbler exports as Puppet variable
settings (of which we currently only use "environment=development" to
tag hosts that use the development environment), although eventually I'd
like to migrate to specifying classes exported from the Cobbler
"Configuration management classes" field instead of using templates.
Our external node classifier looks like this. There are a few things
that might be worth noting:
* We didn't want problems resulting from the Cobbler server being
unavailable, so it uses a short timeout for fetching data from Cobbler
and caches any information it gets, which is returned if the Cobbler
query fails.
* Just in case we wanted to locally override anything in Cobbler, it
will use a "hostname.local" file in preference to any data from
Cobbler.
#!/bin/sh
if [ "x" == "x$1" ]; then
echo "Usage: $0 <hostname>"
exit 1
fi
http_server=cobbler.uoregon.edu
cache=/var/lib/puppet_node_classifier
timeout=1 # seconds
cd $cache
# allow for local node information overriding Cobbler
if [ -f "$1".local ]
then
cat "$1".local
exit 0
fi
# try to look up node in Cobbler, with timeout
if curl --max-time $timeout
"http://$http_server/cblr/svc/op/puppet/hostname/$1" 2>/dev/null |
sed "s/@@http_server@@/$http_server/" >"$1".tmp && [ -s "$1".tmp ]
then
mv "$1".tmp "$1"
else
rm -f "$1".tmp
fi
if [ -f "$1" ]
then
cat "$1"
exit 0
else
exit 1
fi
--
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.