Hiera + Puppet classes

Posted by Amadan on Server Fault See other posts from Server Fault or by Amadan
Published on 2012-11-09T09:28:36Z Indexed on 2012/11/09 11:06 UTC
Read the original article Hit count: 292

Filed under:

I'm trying to figure out Puppet (3.0) and how it relates to built-in Hiera. So this is what I tried, an extremely simple example (I'll make a more complex hierarchy when I manage to get the simple one working):

# /etc/puppet/hiera.yaml
:backends:
  - yaml
:hierarchy:
  - common
:yaml:
  :datadir: /etc/puppet/hieradata

# /etc/puppet/hieradata/common.yaml
test::param: value

# /etc/puppet/modules/test/manifests/init.pp
class test ($param) { notice($param) }

# /etc/puppet/manifests/site.pp
include test

If I directly apply it, it's fine:

$ puppet apply /etc/puppet/manifests/site.pp
Scope(Class[Test]): value

If I go through puppet master, it's not fine:

$ puppet agent --test
Could not retrieve catalog from remote server: Error 400 on SERVER: Must pass param to Class[Test] at /etc/puppet/manifests/site.pp:1 on node <nodename>

What am I missing?

EDIT:

I just left the office but a thought struck me: I should probably restart puppet master so it can see the new hiera.conf. I'll try that on Monday; in the meantime, if anyone figures out some not-it problem, I'd appreciate it :)

© Server Fault or respective owner

Related posts about puppet