hiera v3 to v5 with puppet apply

19 views
Skip to first unread message

Peter Dutton

unread,
Jun 15, 2020, 12:04:45 PM6/15/20
to Puppet Users
Hi all,

I am using puppet in a 'standalone', or 'masterless' capacity to manage the configurations of different server roles. I'm doing this by using 'puppet apply' with a different environment depending on the situation. For example for local development:

puppet apply --modulepath=modules --hiera_config=environments/hiera.yaml --environment=devLocal manifests/init.pp


I'm upgrading the infrastructure and am having trouble converting my workflow to the newer version. I have converted the hiera() function calls to lookup(), and have moved logic around in the hiera.yaml files so that now it should be processing the correct file when the command runs. 


However I currently get an error for each hiera variable, for example: "The Lookup Configuration at '/tmp/vagrant-puppet/environments/devLocal/hiera.yaml' has wrong type, unrecognized key 'server_role'"

The file itself (reduced for simplicity) looks as follows (environments/devLocal/hiera.yaml):


version: 5


server_role
: "frontend"



The code in environments/hiera.yaml is as follows:

version: 5


defaults
:
  datadir
: "environments"
  data_hash
: yaml_data


hierarchy
:
 
- name: "env"
    path
: "%{environment}/hiera.yaml"




Does anyone have any suggestions on how I can make this work?

Peter Dutton

unread,
Jun 15, 2020, 12:09:43 PM6/15/20
to Puppet Users
I've figured this out now - I was mistakenly using hiera.yaml to store the data values. Once I changed it to refer to a different file for the data it was running fine.

Thanks

Peter
Reply all
Reply to author
Forward
0 new messages