On 2015-23-09 8:48, Malintha Adikari wrote:
> I am using hiera lookup as follows in my puppet template
>
> |
> <%-nodeinfo =scope.function_hiera(['nodes'])-%>
> |
>
> I have provided the ..yaml file which includes above 'nodes' object in
> my hiera.yaml file ( that is inside nodesfile.yaml file which is
> dynamically loaded as follows)
>
> |
> ---
> :backends:
> - yaml
> :yaml:
> :datadir: /etc/puppet/hieradata
> :hierarchy:
> - "%{::nodes_file}
> |
>
> I have want to load another data object into my puppet template but the
> problem is that data object is in a .yaml file which is not registered
> in my hiera.yaml file. I cannot register that file in my hiera.yaml.
>
> Is there anyway to load data object providing the file along with the
> lookup method. I do know the .yaml file name that object is in ?
>
You are in Ruby, so you can just load the yaml directly. No need to
involve hiera unless you need some kind of hierarchy / method of
overriding what is in your yaml file. For how to load a yaml file using
Ruby, you will find lots of examples if you google for it.
If you want to do lookups from within the puppet language you need a
function that does the loading. (I think there is one in stdlib).
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/