[Puppet Users] Conditional host file entries, Puppet''s non-sequential tree

Duncan Hill
Wed, 19 Aug 2009 15:03:40 -0000

Hello folks,

Running 0.24.6, and I need a clue-by-4 with something I''m trying to do.

I have a single manifest file, used by 3 servers.  Depending on the
server name, I need to allocate a different set of variables that get
used to populate a host {} block.

Since Puppet doesn''t work in a top-down manner, this has a chance of
working sometimes, but not all the time.

A convoluted approach that just came to mind is to use inheritance
tricks.  Namely:

node application-server inherits generic-server {
 all common stuff other than hosts
 possibly the if logic to set the IPs
}
node specific-1 inherits application-server {
 host {}
}
node specific-2 inherits application-server {
 host {}
}

Are there any better solutions to this?  I''m making the assumption
(that I''m about to test) that inheritance is top-down.