I''ve had this blog post [1] bookmarked for a while to pull the remaining node specific config I have out of my site.pp, but wasn''t sure if there was a better method at this point. I''ve been using hiera_include for a while for classes, but it appears functionality is something that may go away based on this feature [2] and the fact that it is still undocumented [3]. The bug report points out include now takes an array [4] (yeah!), but to get the correct array built from hiera (multiple levels) I have to use hiera_array which is also still undocumented [5]. What is the current recommended way of including classes to be included in your hiera data and is there a recommended method for including resources? Obviously I can implement the stuff Robin and Hunter did if I''m not implementing something that''s going to go away shortly because it is a terrible idea. Thanks, jl [1] http://yo61.com/assigning-resources-to-nodes-with-hiera-in-puppet.html [2] http://projects.puppetlabs.com/issues/11608 [3] http://docs.puppetlabs.com/references/3.1.latest/function.html#hierainclude [4] http://projects.puppetlabs.com/issues/7801 [5] http://docs.puppetlabs.com/references/3.1.latest/function.html#hieraarray -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Wednesday, February 27, 2013 8:34:47 AM UTC-6, Justin Lambert wrote:> > I''ve had this blog post [1] bookmarked for a while to pull the remaining > node specific config I have out of my site.pp, but wasn''t sure if there was > a better method at this point. >The custom ''hiera_resources()'' function described in that blog post appears to be equivalent to a combination of the standard hiera() and create_resources() functions. Whether that general approach is best is an entirely separate question, however, and the answer probably depends on the circumstances.> I''ve been using hiera_include for a while for classes, but it appears > functionality is something that may go away based on this feature [2] and > the fact that it is still undocumented [3]. The bug report points out > include now takes an array [4] (yeah!), but to get the correct array built > from hiera (multiple levels) I have to use hiera_array which is also still > undocumented [5]. >Although hiera_include() may eventually go away, as it is indeed redundant, I don''t think there is any reason to fear that hiera_array() or hiera_hash() will be removed. PL has limited resources at its disposal, and one of the things that has historically been a problem for it is the thoroughness (or lack thereof) of its documentation. It *does* devote effort to documentation, to be sure, but not to such an extent that you can take lack of detailed documentation of hiera_array() to be an indication that it is at risk of removal. If the lack of documentation bothers you then file a ticket against it (supposing there isn''t one already). If you''re really motivated, then Puppet is an open-source project: you can write the documentation and contribute it if you are so inclined.> > What is the current recommended way of including classes to be included in > your hiera data and is there a recommended method for including resources? > Obviously I can implement the stuff Robin and Hunter did if I''m not > implementing something that''s going to go away shortly because it is a > terrible idea. > >Use either $classes = hiera(''classes_key'') include $classes or $classes = hiera_array(''classes_key'') include $classes or a similar approach based on ''include'' instead of ''hiera_include''. If you can, derive resource parameters from class data and/or general hiera data, but if you must model whole resource declarations in hiera then use $resources_hash = hiera(''resource_key'') create_resources(''resource_name'', $resources_hash) to handle them. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
John, Thanks for your response. I wasn''t meaning to complain about the lack of documentation, was just using it as a data point. I was trying to determine if there was something I wasn''t aware of that was available for me to use now or something planned in the future. I know hiera is a relatively new major enhancement to puppet and it is still being determined in some cases how to best utilize it. I (attempted) to add this functionality this morning, we''ll see where it goes (https://projects.puppetlabs.com/issues/19516). This is my first PR to puppet directly, hopefully it is something others feel would be of value also. jl On Feb 28, 2013, at 7:24 AM, jcbollinger <John.Bollinger@stJude.org> wrote:> > > On Wednesday, February 27, 2013 8:34:47 AM UTC-6, Justin Lambert wrote: > I''ve had this blog post [1] bookmarked for a while to pull the remaining node specific config I have out of my site.pp, but wasn''t sure if there was a better method at this point. > > > The custom ''hiera_resources()'' function described in that blog post appears to be equivalent to a combination of the standard hiera() and create_resources() functions. Whether that general approach is best is an entirely separate question, however, and the answer probably depends on the circumstances. > > > I''ve been using hiera_include for a while for classes, but it appears functionality is something that may go away based on this feature [2] and the fact that it is still undocumented [3]. The bug report points out include now takes an array [4] (yeah!), but to get the correct array built from hiera (multiple levels) I have to use hiera_array which is also still undocumented [5]. > > > Although hiera_include() may eventually go away, as it is indeed redundant, I don''t think there is any reason to fear that hiera_array() or hiera_hash() will be removed. PL has limited resources at its disposal, and one of the things that has historically been a problem for it is the thoroughness (or lack thereof) of its documentation. It does devote effort to documentation, to be sure, but not to such an extent that you can take lack of detailed documentation of hiera_array() to be an indication that it is at risk of removal. > > If the lack of documentation bothers you then file a ticket against it (supposing there isn''t one already). If you''re really motivated, then Puppet is an open-source project: you can write the documentation and contribute it if you are so inclined. > > > > What is the current recommended way of including classes to be included in your hiera data and is there a recommended method for including resources? Obviously I can implement the stuff Robin and Hunter did if I''m not implementing something that''s going to go away shortly because it is a terrible idea. > > > Use either > > $classes = hiera(''classes_key'') > include $classes > > or > > $classes = hiera_array(''classes_key'') > include $classes > > or a similar approach based on ''include'' instead of ''hiera_include''. > > If you can, derive resource parameters from class data and/or general hiera data, but if you must model whole resource declarations in hiera then use > > $resources_hash = hiera(''resource_key'') > create_resources(''resource_name'', $resources_hash) > > to handle them. > > > John > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.