Hello to all,
I am in the process of changing a Puppet setup to use environments
and hiera. The environment setup works fine but I have a problem
setting up hiera.
I have a basic Hiera setup in one environment but when I try to use
it I get the following:
puppet master --compile example.com
--environment=testenv --debug
Info: Caching node for example.com
Debug: hiera(): Hiera YAML backend
starting
Debug: hiera(): Looking up
hiera_classes
in YAML backend
Error: Undefined variable
"::trusted.certname";
Undefined variable "trusted.certname" at
/etc/puppet/environments/testenv/manifests/node.pp:1
on node example.com
Error: Undefined variable
"::trusted.certname";
Undefined variable "trusted.certname" at
/etc/puppet/environments/testenv/manifests/node.pp:1
on node example.com
Error: Failed to compile catalog
for
node example.com: Undefined variable "::trusted.certname";
Undefined
variable "trusted.certname" at
/etc/puppet/environments/testenv/manifests/node.pp:1
on node example.com
I use as the hiera.yaml file the setup from
https://docs.puppetlabs.com/hiera/3.0/complete_example.html,
meaning my hiera.yaml file looks like this
---
:backends:
- yaml
:yaml:
:datadir: "/etc/puppetlabs/code/environments/%{environment}/hieradata"
:hierarchy:
- "nodes/%{::trusted.certname}"
- common
In
node.pp I have just a
hiera_include('classes')
in this environment.
How do I get Puppet to populate %{::trusted.certname} with the
certname for the host? Or better what do I need to configure, to get
this setup working?
I am using Puppet 3.6.s on a SLES 12.1 distro.
Thx in advance for any hint and answer,
Michael