Ask Your Question
0

Hiera data is not visible from production environment only

asked 2015-09-09 05:37:05 -0600

szemlyanoy gravatar image

updated 2015-09-09 14:27:54 -0600

GregLarkin gravatar image

Dear all,

We are using:

Open source puppet master/agents - "4.2.1" 
Hiera - "3.0.1"

Hiera config /etc/puppetlabs/code/hiera.yaml :

:hierarchy:
    - "%{::environment}/%{::hostname}"
    - "%{::environment}/%{::hostgroup}"
    - "%{::environment}/%{::operatingsystem}/%{::operatingsystemmajrelease}"
    - "%{::environment}/%{::operatingsystem}/common"
    - "%{::environment}/common"
:backends:
    - yaml
:yaml:
    :datadir: '/etc/hieradata'

I have a class:

class spacewalk::client(
  $server        = '',
  $activationkey = '',
  $register      = false
) { ...

It should receive values from the following datasources depending on OS and major release:

# cat /etc/hieradata/production/CentOS/common.yaml
---
spacewalk::client::register: true
spacewalk::client::server: "spacewalk.domainname"


# cat /etc/hieradata/production/CentOS/6.yaml
---
spacewalk::client::activationkey: "1-xxxxxx"


# cat /etc/hieradata/production/CentOS/7.yaml
---
spacewalk::client::activationkey: "1-yyyyy"

Agent applies manifest properly when I compile it from any environment but production! States of environments are similar.

puppet.conf

[master]
vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /var/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /etc/puppetlabs/code
storeconfigs = true
storeconfigs_backend = puppetdb
reports = store,puppetdb
[main]
environmentpath = $codedir/environments
default_manifest = ./manifests

Did I ran into some misconfiguration of hiera?

Thanks ahead, Sergey

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-09-11 08:31:01 -0600

I'm thinking perhaps your hiera.yaml isnt the same on all nodes? have a look at /etc/puppet/hiera.yaml

edit flag offensive delete link more
0

answered 2015-09-16 10:42:05 -0600

szemlyanoy gravatar image

Hi,

Sorry what do you mean by 'the same on all nodes'? I have single puppet master and few environments there along with production one, hence single common hiera config stored in /etc/puppetlabs/code/hiera.yaml

So ONLY my production puppet run is not interpolating variables stored in hiera behind "%{::environment}/%{::operatingsystem}/common" , from all rest environments it works! Even this doesn't work: "puppet agent --test --environment production"

This DOES work: "puppet agent --test --environment anyenvironment"

Very strange behaviour

Sergey

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2015-09-09 05:37:05 -0600

Seen: 175 times

Last updated: Sep 16 '15