On Tue, Jun 2, 2015 at 3:35 PM, jcbollinger <john.bollin...@stjude.org> wrote: > > > On Tuesday, June 2, 2015 at 2:55:16 AM UTC-5, jamese wrote:
>> You can also use calling_module, but that probably wouldn't give the >> granularity that you want. > > > > Yes, one of these is the standard way to approach such problems, provided > that you're not looking to provide for cross-module data directly via Hiera. > You use the calling_class or calling_module variable to define one or more > levels of your hierarchy (i.e. in hiera.yaml), so that lookups choose the > correct data file for their context. Note that this is actually more > efficient than what you asked: instead of loading all the data files, it > will load exactly the one it needs. +1 to calling_module - I nearly always use this approach when using the YAML back end for Hiera. You are right, it comes with the limitation that I cant look up tango::bar from class foo without some very nasty hackery, but this isn't such a bad thing. If you are relying on this kind of cross-module data sharing then you probably have a larger design issue, modules that require data from other modules should get them by including the class and referencing them in Puppet ($::tango::bar), not circumventing the module and going straight to Hiera, thus keeping any logic (such as params.pp defaults) that the module provides. In a small number of cases I've required a variable from a class that is not included, and therefore this pattern failed - but in all of those cases a small re-think revealed a few design flaws and things were re-factored. Craig -- Enviatics | Automation and configuration management http://www.enviatics.com | @Enviatics Puppet Training http://www.enviatics.com/training/ -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CACxdKhGhEC70%2BP47h5kfpO0mGtSuXAz9QEoHgfWern_Ow5jv3Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.