On 2015-24-09 7:13, Malintha Adikari wrote:
Hi Corey,

Thank you very much for your answer. May be this is what I am looking
for. I have few doubts about the way using this solution.

hiera('nodes', 'default_value', 'nodes/host1234')

*'nodes/host1234' - *Is this a yaml file name ? I know the yaml file
name in which hiera should search data. I want to provide that file name
in the looking up function.


That will not work. If you are using hiera, the configuration of which yaml files that it loads is controlled by the configuration in hiera.yaml.

- henrik



On Wednesday, September 23, 2015 at 9:29:27 PM UTC+5:30, Corey Osman wrote:

    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
    
<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 puppet-users+unsubscr...@googlegroups.com
<mailto:puppet-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/79f39a77-cc92-45b9-86c2-68c79b4fec34%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/79f39a77-cc92-45b9-86c2-68c79b4fec34%40googlegroups..com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
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/mu1tpc%24act%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to