Ask Your Question
0

How come data is not coming from hiera yaml file?

asked 2015-07-20 11:59:04 -0500

Red Cricket gravatar image

Hi,

I am using Puppet Enterprise 3.7.2 and on one of my nodes I create the file:

[root@vii-osc4-mgmt-001 ~]# cat /etc/profile.d/POD_prefix.sh 
export FACTER_pod_prefix=vii-osc4

Then I rebooted that node and logged back in and verified that the FACTERpodprefix gets set and facter pod_prefix outputs the expected value.

[root@vii-osc4-mgmt-001 ~]# env | grep FACTER_pod_prefix
FACTER_pod_prefix=vii-osc4
[root@vii-osc4-mgmt-001 ~]# facter pod_prefix
vii-osc4

On my PE 3.7 Puppet master I created the file /var/lib/hiera/vii-osc4.yaml. I created the /var/lib/hiera/vii-osc4.yaml from the /var/lib/hiera/defaults.yaml file that I had been using like so:

# cp /var/lib/hiera/defaults.yaml /var/lib/hiera/vii-osc4.yaml

This file has a bunch of class parameter values. For example there is this line in the file:

controller_vip_name: vii-osc4.example.com

Then I changed my hiera.yaml file to look like this:

[root@osc4-ppt-001 ~]# 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:

Then I restarted my pe-httpd service like so (RHEL7):

# systemctl restart pe-httpd

Then I make a small change to the /var/lib/hiera/vii-osc4.yaml for example I change the line ...

controller_vip_name: vii-osc4.example.com

... to ...

controller_vip_name: VII-osc4.example.com

But when I run puppet agent -t --noop on my node, vii-osc4-mgmt-001, I do not see the change that I expected to see. If I make the change in the /var/lib/hiera/defaults.yaml and then run puppet agent -t --noop on my node I do see the expected changs. What am I doing wrong here?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-07-21 17:06:07 -0500

Red Cricket gravatar image

I got an answer from Felix (http://stackoverflow.com/questions/31...) and basically I cannot use FACTER_ env vars for this as the services involved to not get the same set of env vars an interactive shell would (kinda like cron I guess). But the answer is even simpler than setting up env vars. I can simply create an /etc/facter/facts.d/pod_prefix.txt file on my nodes and set the value of pod_prefix in the text file with the line: pod_prefix=vii-osc4. Of course, one would still need to modify the hiera.yaml and create vii-osc4.yaml file.

edit flag offensive delete link more

Comments

intersting one! just about to evaluate puppet on rhel 7 so useful point, thanks

sahumphries gravatar imagesahumphries ( 2015-07-22 02:17:30 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-07-20 11:59:04 -0500

Seen: 452 times

Last updated: Jul 21 '15