You should be able to just use the normal hiera syntax.  example: 
hiera('nodes', 'default_value', 'nodes/host1234')

Documented here:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/functions/hiera.rb

Also, its bad practice to lookup hiera from within a template. Put the 
value in a puppet variable and then just use the variable in the template.
This way the next person will not have to troubleshoot your template.

Corey
On Tuesday, September 22, 2015 at 11:48:33 PM UTC-7, 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 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e55a62e7-b470-4e94-acdf-d53d57ae0fa9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to