Upgraded Puppet server from 3.8 to 4.5 and Hiera stopped working

102 views
Skip to first unread message

Bret Wortman

unread,
Jun 13, 2016, 3:54:28 PM6/13/16
to Puppet Users
This morning, I upgraded to Puppet 4 using the PC1 repository and even through I have the puppet server running, the Hiera files we rely heavily on aren't being seen. I'm getting false values for everything which really screwed up some of the boxes I was testing with.

# hiera -c /etc/puppetlabs/code/hiera.yaml localtime::timezone -y test.yaml
Could not load YAML scope: LoadError: cannot load such file -- puppet
# cat /etc/puppetlabs/code/hiera.yaml
---
:backends:
  - yaml

:yaml:
  :datadir: "/etc/puppetlabs/code/environments/${::environment}/hieradata"

:hierarchy:
  - "%{::hostname}"
  - "%{::sitename}"
  - common

# ls /etc/puppetlabs/code/environments/production/hieradata/common.yaml
/etc/puppetlabs/code/environments/production/hieradata/common.yaml
# cat test.yaml
---
"::hostname": testws
"::sitename": hq
# rpm -qa | grep hiera
hiera-1.3.4-5.el7.noarch
# rpm -qa | grep puppet
puppetdb-3.2.2-1.el7.noarch
puppetserver-2.2.1-1.el7.noarch
puppet-agent-1.3.5-1.el7.x86_64
#

All the files under environments/production/hieradata used to reside under /etc/puppet/environments/production/data, but were moved & renamed to accomodate the upgrade. And promptly stopped working.

Where should I be looking? Do I still need to have the "puppet" rpm installed?


Bret

Peter Kristolaitis

unread,
Jun 13, 2016, 4:06:56 PM6/13/16
to puppet...@googlegroups.com
I suspect your hiera install is confused because you have both the puppet-agent and hiera packages installed.   Hiera now ships as part of the puppet-agent package and gets installed as /opt/puppetlabs/bin/hiera; there is no separate hiera package.  Hiera 1.3.4 is also quite old -- on a box with puppet-agent v1.5.1 installed, 'hiera -v' gives me version 3.2.0.

You probably need to get rid of the hiera package and make sure that you're using the new version provided by puppet-agent.
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/63b7a931-d52c-4c1a-822d-f9000e87507f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bret Wortman

unread,
Jun 13, 2016, 4:37:03 PM6/13/16
to Puppet Users
That got me past the error, but I still am getting "nil" no matter what I ask for.

And I've looked -- the keys I'm querying for are defined, at a minimum, in /etc/puppetlabs/code/environments/production/hieradata/common.yaml.

Bret Wortman

unread,
Jun 13, 2016, 4:37:51 PM6/13/16
to Puppet Users
Oh, and my hiera version is now 3.0.6. We lag a bit behind on our development & production networks....

Peter Kristolaitis

unread,
Jun 13, 2016, 4:56:19 PM6/13/16
to puppet...@googlegroups.com
With the change to "split environments by default", you need to provide the environment name on the command line:

[root@sh00cw-pup01ny hieradata]# hiera profiles::packages::centos
nil
[root@sh00cw-pup01ny hieradata]# hiera profiles::packages::centos environment=production
["bind-utils", "curl", "nmap", "tcpdump", "unzip", "wget"]

This is done automatically by the Puppet server when compiling the manifest, but you need to do it manually on the command line.

Bret Wortman

unread,
Jun 13, 2016, 5:09:07 PM6/13/16
to Puppet Users
Somehow, I got this working. I'm honestly not sure how, but I'm not going to argue with success.

I've restarted the server and it's still working. Thanks for your help, Peter!
Reply all
Reply to author
Forward
0 new messages