Ask Your Question

camptocamp-accounts, hiera

asked 2015-03-30 07:19:57 -0500

siddz gravatar image


I'm quite new to puppet. Can someone please explain me this usage advisory? The YAML example seems clear to me, that's what I expect when using hiera. But according to my understandings adding something like

accounts::account { 'foo': }


accounts::account { 'bar':
  authorized_keys => ['@foo', 'baz'],


accounts::account { '@foo': }

to a manifest file breaks the concept of separating data from logic and also supersedes the usage of hiera with this module. Could someone please enlighten me?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-03-31 15:53:54 -0500

WhatsARanjit gravatar image

Yeah, the idea of Hiera is to separate the data from the code. You can use the automatic data-binding feature of hiera to "inject" class parameters. So let's say I have a class like this:

class foo (
  $param1 = 'default',
) {

So this is a dummy class that takes one parameter called 'param1'. I can declare this class like the following:

class { 'foo': }


class { 'foo':
  param1 => 'not-default',

This means I'm specifically declaring the class with no parameters or with param1 set to 'not-default'. If I instead declare the class like this:

include foo

Now I can make use of the data-binding feature. Having not specified the params, hiera will automatically look for a key following the pattern classname::paramname. So somewhere in my hiera, I can put the following:

foo::param1: somevalue

And now that value will get picked up and used automatically. This auto lookup is only done if the parameters are not specifically given in code or through an ENC.

edit flag offensive delete link more


I've asked this on multiple channels but by now never got an understandable answer. Thanks for putting this in a nutshell. But I still wonder how to create accounts in a yaml file with this module? "accounts::account: admin" doesn't whereas account creation via site.pp does. edit: got it. thx.

siddz gravatar imagesiddz ( 2015-04-01 06:59:07 -0500 )edit

got it? How?

pgh2011 gravatar imagepgh2011 ( 2015-09-07 08:01:02 -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


Asked: 2015-03-30 07:18:36 -0500

Seen: 334 times

Last updated: Mar 31 '15