|
Re: Template Nodes considered harmful: msg#00242sysutils.puppet.user
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 16 October 2007, David Schmitt wrote: > Hi Russ, Digant, *! > > Several times on the IRC channel I noticed people having problems getting > to grips with the interaction of scopes when using template nodes[1]. > Typically > > this looks thus: > | node genericwebserver { stuff } > | > | node 'web01.example.com' inherits genericwebserver { > | $influence_genericwebserver = "other_stuff" > | } > > Due to 'web01.example.com's scope being "below" or "within" the scope of > genericwebserver, the defined variable never reaches the included resources > and thus never affects the template node as intended. Since template nodes > -- at least in my experience -- only contain includes anyway, not even the > need for overriding can be argued. > > The pattern of template nodes is originally described on > PuppetBestPractice[2], therefore I'd like to solicit at least one or two > comments before changing the page. > > MY proposed solution is to change all template nodes into template classes > and > > instead of inheritance use inclusion: > | class genericwebserver { stuff } > | > | $influence_genericwebserver = "site default" > | > | node 'web01.example.com' { > | $influence_genericwebserver = "node specific override" > | include genericwebserver > | } > > As shown in the example, this allows for site defaults and per-node > overrides for variables which will be propagated to the genericwebserver. > > > > Regards, David > > [1] http://reductivelabs.com/trac/puppet/wiki/GlossaryOfTerms#templatenode > [2] http://reductivelabs.com/trac/puppet/wiki/PuppetBestPractice The discussion has brought me to another realisation. When using a external node definition script, node inheritance can't be used at all. This and the following (shortened) IRC conversation lead me to the conclusion that using template nodes should be completely replaced by using a standard class in the PuppetBestPractise document on the wiki. Therefore I will go on and rewrite that part. (20:16:02) sheeri: also, if there's no multiple inheritance, why do I bother setting up nodes for things....why not just classes, since I can include multiple classes? (20:16:21) sheeri: certainly I can see the need for something being both a "webserver" and a "dbserver".......which I'd think multiple inheritance would be the way to go (20:16:32) sheeri: but http://reductivelabs.com/trac/puppet/ticket/229 seems to think otherwise (20:16:34) gepetto: [Link Info] title: #229 (Inheritance of nodes and scope of variables.) - puppet - Trac (20:18:42) DavidS: sheeri: a) nodes are semantically very different from classes b) see "templating nodes considered harmful" on -users (20:20:37) sheeri: I understand they're different, but I was under the impression you'd use nodes to assign various machines to their respective feature domainsets. ie, "node machine.domain.com inherits webserver" (20:20:54) sheeri: Sure, although if there's an online archive, I'm happy to help myself. (20:21:03) sheeri: I just can't RTFM if I don't know where FM is :) (20:23:43) DavidS: start at this post http://mail.madstop.com/pipermail/puppet-users/2007-October/004768.html (20:24:41) sheeri: so the answer is -- use nodes for machine names (20:24:54) sheeri: use classes to set up featureset domains. (20:24:57) sheeri: :) (20:24:58) DavidS: right (20:25:01) sheeri: OK. (20:25:09) DavidS: also .. compare it to the external_nodes support (20:25:14) sheeri: perhaps the sample puppet configs want to be changed, then. They're extremely misleading (20:25:25) DavidS: sheeri: which ones? (20:25:35) sheeri: *nod* yeah, that's nice, the external_nodes support. (20:25:58) DavidS: with external nodes, a node can _only_ have variables and classes assigned (20:26:01) sheeri: manifests/nodes.pp and manifests/templates.pp (20:26:18) sheeri: they might not be part of the package, maybe the online docs...I'll check the trac stuff for it (20:26:41) DavidS: sheeri: wiki:PuppetBestPractice ? (20:26:43) gepetto: sheeri: PuppetBestPractice is http://reductivelabs.com/trac/puppet/wiki/PuppetBestPractice (20:27:04) sheeri: yes, in fact (20:27:05) sheeri: :) (20:27:14) sheeri: that's the only doc that has nodes.pp in it, actually (20:27:30) ***sheeri wants to rename it KindaMaybeSortaOKPractice (20:27:37) DavidS: you are one victim in a long row of people I had to explain this to. (20:27:46) sheeri: :) (20:27:50) DavidS: So actually I should go forward and just change this part (20:27:55) ***sheeri nominates DavidS to change that (20:27:58) sheeri: exactly :) (20:28:07) jendroyd: as someone who just figured it out last week too... I concur! Regards, David - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHHj6V/Pp1N6Uzh0URApoQAJ9RTfRnmhT+k6Nlum7Yo9SBfRC9rACeLme9 +kCprL5Ex9FODb0vfSq0JV8= =Bo7/ -----END PGP SIGNATURE----- |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: puppetmaster --genconfig: 00242, ADNET Ghislain |
|---|---|
| Next by Date: | Re: Template Nodes considered harmful: 00242, Digant C Kasundra |
| Previous by Thread: | Re: Template Nodes considered harmfuli: 00242, Russ Allbery |
| Next by Thread: | Re: Template Nodes considered harmful: 00242, Digant C Kasundra |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |