I cannot seem to figure out how access my hiera data that I put into my yaml file.
Here is my hiera.yaml:
[root@vxx-osc4-ppt-001 puppetmaster]# cat /etc/puppetlabs/puppet/hiera.yaml
---
:backends:
- yaml
:hierarchy:
- "%{pod_prefix}"
- defaults
- "%{clientcert}"
- "%{environment}"
- global
:yaml:
# datadir is empty here, so hiera uses its defaults:
# - /var/lib/hiera on *nix
# - %CommonAppData%\PuppetLabs\hiera\var on Windows
# When specifying a datadir, make sure the directory exists.
:datadir:
After I changed the above file I restarted my 3.7 PE Puppet master like so:
[root@vxx-osc4-ppt-001 puppetmaster]# systemctl restart pe-httpd
Also I have these two yaml files that contain the key/value pair for a classparameter, controller_vip_name. So I have this ...
[root@vxx-osc4-ppt-001 puppetmaster]# grep "^controller_vip_name:" /var/lib/hiera/*yaml
/var/lib/hiera/defaults.yaml:controller_vip_name: VXX-osc4.example.com
/var/lib/hiera/vxx-osc4.yaml:controller_vip_name: vxx-osc4.example.com
... note that in the file vxx-osc4.yaml
the value of controller_vip_name
is vxx-osc4.example.com
all lower case and in the defaults.yaml file the value of controller_vip_name
is VXX-osc4.example.com
where VXX is uppercase. I am trying to QA my set up like so:
[root@vxx-osc4-ppt-001 puppetmaster]# hiera controller_vip_name
VXX-osc4.example.com
The above command works and hiera retrieves the data from the defaults.yaml
file
But this command does not work:
[root@vxx-osc4-ppt-001 puppetmaster]# hiera "pod_prefix=vxx-osc4" controller_vip_name
controller_vip_name
I think hiera
completely ignored my vxx-osc4.yaml
file.
What am I doing wrong here?
Your hiera command is wrong:
Usage: hiera [options] key [default value] [variable='text'...]
Notice that variables come after the key.