I upgraded the puppet server from 2.1.1-1 to 2.7.2-1 and at the same time the puppet agent was upgraded from 1.2.2-1 to 1.10.4-1.
I read several different posts on this forum and others but I can't seem to get hiera 5 to work properly. I tried a couple of different hiera.yaml config files yet nothing seems to work correctly. I've tried to use the old hiera.yaml version and getting the expected depricated warning. The Puppet doci on V5 and converting is not the greatest.
Our hiera config uses both json files and couchdb. Everytime I run puppet lookup I get:
[root@xlabsvcpup4 code]# puppet lookup pup_url
Warning: /etc/puppetlabs/code/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
(in /etc/puppetlabs/code/hiera.yaml)
Warning: Undefined variable '::my_role';
(file & line not available)
Error: Could not run: HTTP request path is empty
Current hiera.yaml file:
[root@xlabsvcpup4 code]# cat hiera.yaml
---
:backends:
- http
- json
- yaml
:hierarchy:
- "%{::clientcert}"
- "%{::environment}/%{::clientcert}"
- "%{::environment}/%{::my_role}"
- "%{::environment}/common"
- "%{::my_role}"
- common
:json:
:datadir: /u01/hieradata/
:yaml:
:datadir: /u01/hieradata/
:http:
:port: 5984
:output: json
:failure: graceful
:use_auth: true
:auth_user: 'userid'
:auth_pass: 'password'
:paths:
- /hieradb/%{::clientcert}
- /%{::environment}/%{::my_role}
- /%{::environment}/common
- /hieradb/%{::my_role}
- /hieradb/common
I tried to use this version 5 config file:
---
version: 5
defaults:
datadir: "/u01/hieradata"
data_hash: json_data
hierarchy:
- name: "json files"
paths:
- "%{::clientcert}.json"
- "%{::environment}/%{::clientcert}.json"
- "%{::environment}/%{::my_role}.json"
- "%{::environment}/common.json"
- "%{::my_role}.json"
- common.json
- name: "Couchdb"
options:
connections:
hiera3_backend: hiera-http
output: json
failure: graceful
use_auth: true
auth_user: 'userid'
auth_pass: 'password'
paths:
- /hieradb/%{::clientcert}
- /%{::environment}/%{::my_role}
- /%{::environment}/common
- /hieradb/%{::my_role}
- /hieradb/common
When I use the V5 config i get:
Warning: Undefined variable '::my_role';
(file & line not available)
Error: Could not run: 'json_data' one of 'path', 'paths' 'glob', 'globs' or 'mapped_paths' must be declared in hiera.yaml when using t