There's a pattern I've run into a lot recently mhere a config file
needs to be built based on information from a number of puppet
managed hosts. Assume here than I mean "node" in the puppet sense
when I say "host". *shrug*
Use cases:
- backups, where each host has directories that need to be backed
up, and things need to be done on the individual backup client
hosts to handle that, and *also* stuff needs to be done on the
backup master
- deploy configuration, where each host has a deploy role and it
makes most sense to talk about the deploy role in each host's
puppet config, but the file that manages the deployment is on
the deploy master host
- VM configuration, where information about a VM needs to affect
data/configuration stored on the host that holds that VM
All the same general pattern of action-at-a-distance: configuration
on a number of hosts affecting the master config file on a single
host.
Also, multi-part config files: in at least some of these cases, the
information from each host generates some configuration file output,
perhaps from a template, but all of those bits of config file need
to be merged together into one master config file.
These don't seem, to me, to be things puppet handles natively, and
(see my other posts) new types don't seem to be being added all that
often.
So, my question is this: what's the right way to handle this sort of
situation?
Feel free to break the action-at-a-distance bit and the
multipart-config-file-merge bit into seperate pieces, if you like.
Thanks so much for your time!
-Robin
--
http://singinst.org/ : Our last, best hope for a fantastic future.
Lojban (http://www.lojban.org/): The language in which "this parrot
is dead" is "ti poi spitaki cu morsi", but "this sentence is false"
is "na nei". My personal page: http://www.digitalkingdom.org/rlp/
(I'm going a bit more for philosophical discussion than practicality
here, maybe. Do at least feel free to think in terms of what Puppet
*should* do rather than tha fastest way to solve this problem.)There's a pattern I've run into a lot recently mhere a config file
needs to be built based on information from a number of puppet
managed hosts. Assume here than I mean "node" in the puppet sense
when I say "host". *shrug*Use cases:
- backups, where each host has directories that need to be backed
up, and things need to be done on the individual backup client
hosts to handle that, and *also* stuff needs to be done on the
backup master- deploy configuration, where each host has a deploy role and it
makes most sense to talk about the deploy role in each host's
puppet config, but the file that manages the deployment is on
the deploy master host- VM configuration, where information about a VM needs to affect
data/configuration stored on the host that holds that VMAll the same general pattern of action-at-a-distance: configuration
on a number of hosts affecting the master config file on a single
host.
Also, multi-part config files: in at least some of these cases, the
information from each host generates some configuration file output,
perhaps from a template, but all of those bits of config file need
to be merged together into one master config file.
I recently adopted puppet-concat, and found it my new big hammer for
almost everything. I had previously set up a define for a simple
header/body/footer structure where only those who cared would supply a
custom body template name as an argument. When it came time to add more
smarts, it was trivial to swap out the file resource in the define and
insert both a concat and a concat::fragment.
I now still have the old three-template API as well as a "provide any
fragments you like, but know that the header/body/footer have order
01/50/99" mechanism available.
One could also use Augeas, but I do not feel that it would fit the
original poster's desire to find a strong and helpful standard.
Augeas doesn't do well when you need to assert the state of a file
overall (which is at the heart of puppet's declarative nature) but with
responsibility divided among systems. It does much better when you need
to surgically assert one or two lines or stanzas in an otherwise
unmanaged file.
I'll just say that Augeas is named after a man who let his stables fill
up with so much crap that Hercules had to divert two whole rivers to
pressure-hose it clean again. You can't make this stuff up.
--
"These people program the way Victorians dress.
It takes two hours and three assistants to put on
your clothes, and you have to change before dinner.
But everything is modular." -- Miles Nordin, on PAM
Can you use exported resources to generate such an array?
Anybody? I can see how to generate resources from lots of hosts and
run it on one host, but I can't see how to generate a config file
out of all of that information.
If you use a concat mechanism as described in this thread, you can have
each of your machines export a respective snippet and the target machine
realizes those and concatenates them to your config file.
HTH,
Felix
On Tue, Jan 11, 2011 at 12:07:30PM -0800, Robin Lee Powell wrote:
> On Tue, Jan 11, 2011 at 05:20:38AM -0800, Al @ Lab42 wrote:
> >
> > You can build a file based on different "fragments" at least in
> > 2 ways:
> >
> > - When you specify an array of templates , when using the
> > content => argument, these templates are actually appended in
> > the defined order.
>
> Can you use exported resources to generate such an array?Anybody? I can see how to generate resources from lots of hosts and
run it on one host, but I can't see how to generate a config file
out of all of that information.-Robin