----- Original Message ----- > From: "Ellison Marks" <gty...@gmail.com> > To: puppet-users@googlegroups.com > Sent: Tuesday, December 18, 2012 6:28:35 PM > Subject: Re: [Puppet Users] early clean exit from module? > > No, it's additive. It will get all the class names from all hierarchy > levels that a host maps to. It uses almost the same code as > hiera_array(), (also undocumented XP, it essentially builds an array > out of all the elements in the specified variable at all levels of > the hierarchy matching the host), then just calls include on the > elements in the resulting list.
I think it's not documented cos in recent versions of puppet its not needed you can do include(hiera_array("classes")) or whatever, older puppet - ie when hiera was first written - had a bug with array input to the include function. > > On Tuesday, December 18, 2012 10:20:21 AM UTC-8, Philip Brown wrote: > > > > On Tuesday, December 18, 2012 9:33:13 AM UTC-8, Ellison Marks wrote: > > You're looking for the hiera_include() function, I believe. It's > undocumented in the official docs, which is a shame, but I'll try to > describe it. > > Your node definition would look something like this: > > node default { > hiera_include('classes') > } > > This instructs every node to look up the classes variable in hiera. > It doesn't need to be named classes, but I like that name. This > variable should evaluate to a list of strings. Each of these strings > will then be treated as a class name and puppet will attempt to > 'include' it. You make your hierarchy so that each node gets an > appropriate list. > > > > > Hmm. Thanks for the explanation. It sounds *potentially* useful. > However, still one problem: > I dont think it's additive. > > In other words, you cant have a truly modular flow in hiera, where > you have > the following pseudocode > > $(allhosts ) => gets 'classes' list from common.yaml > > $(dbmachines) => gets additional classes from dbhosts.yaml > > $(webmachines) => gets additional classes from webhosts.yaml > > > If you want a host that is both a db machine, AND a webserver, you > need to create a new hiera file, > dbandwebhost.yaml > and then make sure that all machines in that context, get pointed to > that specific file, rather than getting to merge things. > > > The only method I see that uses the "pure" hiera_include method you > show above, and still allows for mix-and-max class includes, would > be to handcraft individual > > FQDN.yaml > > files for each and every host. ? > > > > > > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/Vx2_K8OIbREJ . > 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. > > No, it's additive. It will get all the class names from all hierarchy > levels that a host maps to. It uses almost the same code as > hiera_array(), > (also undocumented XP, it essentially builds an array out of all the > elements in the specified variable at all levels of the hierarchy > matching > the host), then just calls include on the elements in the resulting > list. > > On Tuesday, December 18, 2012 10:20:21 AM UTC-8, Philip Brown wrote: > > > > > > > > On Tuesday, December 18, 2012 9:33:13 AM UTC-8, Ellison Marks > > wrote: > >> > >> You're looking for the hiera_include() function, I believe. It's > >> undocumented in the official docs, which is a shame, but I'll try > >> to > >> describe it. > >> > >> Your node definition would look something like this: > >> > >> node default { > >> hiera_include('classes') > >> } > >> > >> This instructs every node to look up the classes variable in > >> hiera. It > >> doesn't *need* to be named classes, but I like that name. This > >> variable > >> should evaluate to a list of strings. Each of these strings will > >> then be > >> treated as a class name and puppet will attempt to 'include' it. > >> You make > >> your hierarchy so that each node gets an appropriate list. > >> > >> > >> > > > > Hmm. Thanks for the explanation. It sounds *potentially* useful. > > However, > > still one problem: > > I dont think it's additive. > > > > In other words, you cant have a truly modular flow in hiera, where > > you have > > the following pseudocode > > > > $(allhosts ) => gets 'classes' list from common.yaml > > > > $(dbmachines) => gets additional classes from dbhosts.yaml > > > > $(webmachines) => gets additional classes from webhosts.yaml > > > > > > If you want a host that is both a db machine, AND a webserver, you > > need to > > create a new hiera file, > > dbandwebhost.yaml > > and then make sure that all machines in that context, get pointed > > to that > > specific file, rather than getting to merge things. > > > > > > The only method I see that uses the "pure" hiera_include method you > > show > > above, and still allows for mix-and-max class includes, would be to > > handcraft individual > > > > FQDN.yaml > > > > files for each and every host. ? > > > > > > > > > > > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/Vx2_K8OIbREJ. > 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. > > -- 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.