On Dec 24, 2008, at 2:55 AM, Peter Meier wrote:
> > Hi > >> So the way I have implemented it is that we have a basenode node >> with the >> common elements that all nodes get. The basenode is then inherited >> by each >> of the specific nodes, therefore you get something like: >> >> import "foo" >> import "httpd" >> >> node basenode { >> include foo >> } >> >> node webnode inherits basenode { >> include httpd >> } >> >> node www1.example.com inherits webnode {} >> node www2.example.com inherits webnode {} >> >> >> Does that make sense? > > > yeah that will work. However sooner or later you will get one > problem here: > > if you use in the class httpd a variable which should be defined in > the > node and you will define this variable in the definition of > www1.example.com, this variable will always be empty, as the class > gets > evaluated before the variable is set in the subnode of the webnode. I understand this is just the way puppet works, but it's very counterintuitive. If puppet wasn't a declarative language, it would make perfect sense. Shouldn't puppet gather all variables and set their values before evaluating resources? I haven't delved in to the code to see if this is possible or not. > > > So something like that, will give you problems: > > node webnode inherits basenode { > include httpd > } > > node www1.example.com inherits webnode { > # i'm used in the class httpd > $httpd_server_name = $fqdn > } > > this is how inheritance works for nodes and which "confuses" a lot of > people. Therefore imho the best thing is to do inheritance in a > bunch of > config-classes and using nodes only to set variables and include the > config class in every node _after_ setting all the variables. Or > switching over to external nodes, which will give you a lot more > flexibility than the site.pp file. > > cheers pete > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---