Hi,
I am switching to hiera5. My opensource puppet master and nodes are working fine and are able to consume the hiera data, but I would like to be able to run `hiera` from the command line on my puppet master to QA my hiera data. With the previous version of hiera I had a shell script that execute a bunch of hiera commands. For example it would execute:
/opt/puppetlabs/bin/hiera controller_vip_name '::pod_prefix=fab-aos' '::pod_role=controller' '::ipaddress_eth0=123.456.789.012' '::fqdn=fake-fqdn.example.com' '::processorcount=fake-processor-count' environment=production
The problem is that the above command and all of the commands executed by my script return `nil`.
If I run the above command on my puppet master with debug I get this output:
DEBUG: 2017-06-21 16:54:29 +0000: Hiera YAML backend starting
DEBUG: 2017-06-21 16:54:29 +0000: Looking up controller_vip_name in YAML backend
DEBUG: 2017-06-21 16:54:29 +0000: Ignoring bad definition in :hierarchy: 'nodes/'
DEBUG: 2017-06-21 16:54:29 +0000: Looking for data source common
DEBUG: 2017-06-21 16:54:29 +0000: Cannot find datafile /etc/puppetlabs/code/environments/production/hieradata/common.yaml, skipping
I have these hiera.yaml files on my puppet master:
# cat /etc/puppetlabs/puppet/hiera.yaml
---
:backends:
- yaml
:hierarchy:
- "nodes/%{::trusted.certname}"
- common
:yaml:
# datadir is empty here, so hiera uses its defaults:
# - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix
# - %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata on Windows
# When specifying a datadir, make sure the directory exists.
:datadir:
and a larger one:
# cat /etc/puppetlabs/code/environments/production/hiera.yaml
---
version: 5
defaults:
data_hash: yaml_data # Use the built-in YAML backend.
datadir: "/etc/puppetlabs/code/environments/%{environment}/hieradata"
hierarchy:
- name: "Eyaml Data"
lookup_key: eyaml_lookup_key
options:
pkcs7_private_key: /etc/puppetlabs/puppet/keys/private_key.pkcs7.pem
pkcs7_public_key: /etc/puppetlabs/puppet/keys/public_key.pkcs7.pem
paths:
- "nodes/%{::trusted.certname}.yaml"
- "nodes/%{::pod_role}.yaml"
... many more paths omitted for brevity ....
I believe I have to most up-to-date software installed:
# puppet -V
4.10.4
# hiera --version
3.3.2
↧