Hello, We are making an initial, small scale Puppet deployment to test Puppet and also to learn more of how Puppet can be used in our environment. My question is regarding the default node and how it applies when a defined node connects - this is perhaps best explained with a few examples, to start with a very basic nodes.pp - --- nodes.pp --- node default { include unix } --- eof --- The "unix" class is just the permissions and ownership policy for the passwd, group and shadow files - a fairly standard example. I wish to expand the nodes.pp to look like this - --- nodes.pp --- node default { include unix } node freebsd-box { File["/etc/passwd"] { group => wheel } File["/etc/shadow"] { group => wheel } } --- eof --- Does the default node apply to all nodes, including those with their own node entry or only nodes without an explicit node entry? That is, will I need to make the "freebsd-box" explicitly inherit the "default" node? I hope this makes sense - feel free to ask for clarification. Cheers, Fred. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Fred, This does indeed make sense and yes, you will need to ''inherit'' the default node to have other nodes apply the settings. Trevor On Mon, Dec 22, 2008 at 08:22, Fred Clausen <ftclausen@gmail.com> wrote:> > Hello, > > We are making an initial, small scale Puppet deployment to test Puppet > and also to learn more of how Puppet can be used in our environment. > > My question is regarding the default node and how it applies when a > defined node connects - this is perhaps best explained with a few > examples, to start with a very basic nodes.pp - > > --- nodes.pp --- > node default { > include unix > } > --- eof --- > > The "unix" class is just the permissions and ownership policy for the > passwd, group and shadow files - a fairly standard example. > > I wish to expand the nodes.pp to look like this - > > --- nodes.pp --- > node default { > include unix > } > > node freebsd-box { > File["/etc/passwd"] { group => wheel } > File["/etc/shadow"] { group => wheel } > } > --- eof --- > > Does the default node apply to all nodes, including those with their > own node entry or only nodes without an explicit node entry? That is, > will I need to make the "freebsd-box" explicitly inherit the "default" > node? > > I hope this makes sense - feel free to ask for clarification. > > Cheers, > > Fred. > > > >--~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Hi> This does indeed make sense and yes, you will need to ''inherit'' the > default node to have other nodes apply the settings.well actually you have to inherit the unix class, that you overwrite the parameters. Pay attention to the fact that inheritance in nodes is slightly different than in classes. The Best thing imho is to build such inheritance in the classes itself and leave any inheritance out of the node definitions. 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Fred-> Does the default node apply to all nodes, including those with their > own node entry or only nodes without an explicit node entry? That is, > will I need to make the "freebsd-box" explicitly inherit the "default" > node? >The answer as stated in http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#nodes, is that the default node is used when there is _no_ other matching node. Evan --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, On Dec 22, 4:41 pm, "Evan Hisey" <ehi...@gmail.com> wrote:> Fred- > > > Does the default node apply to all nodes, including those with their > > own node entry or only nodes without an explicit node entry? That is, > > will I need to make the "freebsd-box" explicitly inherit the "default" > > node? > > The answer as stated inhttp://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#nodes, is > that the default node is used when there is _no_ other matching node. >Thanks all for the helpful advice and the timely reference to the Fine Manual :-) I will indeed do the inheritance through the the classes - perhaps make a class called "myworkplace-standard" that will pull in all classes we need and include this "myworkplace-standard" in all nodes (default or otherwise.) Cheers, Fred. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Robin Lee Powell
2008-Dec-22 19:22 UTC
[Puppet Users] Re: Understanding the "default" node.
On Mon, Dec 22, 2008 at 03:08:44PM +0100, Peter Meier wrote:> > Pay attention to the fact that inheritance in nodes is slightly > different than in classes. The Best thing imho is to build such > inheritance in the classes itself and leave any inheritance out of > the node definitions.Can you explain that in a bit more detail? -Robin -- They say: "The first AIs will be built by the military as weapons." And I''m thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Hi>> Pay attention to the fact that inheritance in nodes is slightly >> different than in classes. The Best thing imho is to build such >> inheritance in the classes itself and leave any inheritance out of >> the node definitions. > > Can you explain that in a bit more detail?Some of that I explained in these 2 mails: http://markmail.org/message/ivwno5cpaouavgsu http://markmail.org/message/ls2bxc7yqwre564s however, I thought that I explained in another thread it more in a detail, but I can''t find it anymore. If you have further questions, don''t hesitate to ask. 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
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? On Mon, Dec 22, 2008 at 2:32 PM, Peter Meier <peter.meier@immerda.ch> wrote:> > Hi > > >> Pay attention to the fact that inheritance in nodes is slightly > >> different than in classes. The Best thing imho is to build such > >> inheritance in the classes itself and leave any inheritance out of > >> the node definitions. > > > > Can you explain that in a bit more detail? > > Some of that I explained in these 2 mails: > > http://markmail.org/message/ivwno5cpaouavgsu > http://markmail.org/message/ls2bxc7yqwre564s > > however, I thought that I explained in another thread it more in a > detail, but I can''t find it anymore. > If you have further questions, don''t hesitate to ask. > > 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
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. 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---