Sebastian Schulze
2012-Nov-01 17:13 UTC
[Puppet Users] Lookup and scoping of hiera data from erb templates
Hey Folks. Reading through the docs and the mailing list only helped confusing me more, so maybe its better to just ask if my approach is correct. Imagine a basic project structure with a module and two classes inside: modules |- my_module |-frontend |-backend I''m using Hiera to manage dynamic values, so lets say I have: --- backend: foo: bar: "boo" baz: 42 So now, if I have an erb template in the my_module::backend class, the only way to get directly to the values is via a helper variable like class my_module::backend { $config = hiera("backend") } and then access it in the template via <%= scope.lookupvar("my_module::backend::config")["foo"]["bar"] %> Which works, but kind of doesn''t feel right. (Neither does leaving away the scope.lookupvar()). What would be the idiomatic approach to this? Is there a way to access Hiera values directly via the ERB template or is it always recommended to "pipe" them through my puppet modules? Thanks, Sebastian -- 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.