----- Original Message -----
> From: "Andreas Paul" <xorp...@googlemail.com>
> To: puppet-users@googlegroups.com
> Sent: Monday, April 30, 2012 2:52:00 PM
> Subject: [Puppet Users] querying hiera data without providing host/scope
> 
> Hello there,
> 
> I need to access the following hiera data in a script:
> $ hiera -c /etc/puppet/hiera.yaml tomcats environment=development
> line=intra3
> ["tc7_test1", "tc7_test8"]
> or
> $ hiera -c /etc/puppet/hiera.yaml apache_port environment=development
> line=intra3 name=tc7_test1
> 81
> 
> The example on https://github.com/puppetlabs/hiera uses facts of a
> specific hosts.
> I don't want to specify and load each YAML file for each host,
> because the hosts are already defined for a specific line and stage
> environment:
> $ hiera -c /etc/puppet/hiera.yaml hosts environment=development
> line=intra3
> ["serverA.domain.tld", "serverB.domain.tld"]
> 
> But I can't get the hiera.lookup to work without providing a scope
> with the facts of a specific host.

In this case the scope is just a hash so the cli command:

$ hiera -c /etc/puppet/hiera.yaml hosts environment=development line=intra3

translates to:

hiera.lookup("hosts", nil, {"environment" => "development", "line" => "intra3"})

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to