Ask Your Question

What is the variable format for autolookups for defines?

asked 2012-12-19 15:06:04 -0500

llowder gravatar image

updated 2012-12-19 15:06:47 -0500

I believe the data binding in puppet 3 is supposed to be extended to defines and their parameters and not just class parameters.

I know for a class:

class module::foo(
 $param1 = 'abc',

It will essentially do the same as:

class module::foo (
  $param1 = hiera('foo::param1', 'abc')

As classes are singletons, no big deal. However, defines are not.

define module::bar (
  $param1 = 'abc'
) {

if I then do:

module::bar{'bubba': }

What can I put in hiera to set param1 to 'xyz' for the bubba instance?

I tried:

module::bar::bubba::param1: 'xyz'

but that did not work, and I ... (more)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-19 16:26:25 -0500

dblessing gravatar image

Unfortunately there is no way to use hiera to specify a defined type. In the last notation you provided you are not addressing the class 'module::bar' with instance name 'bubba'. Rather, you are specifying class 'module::bar::bubba' which does not exist.

I have found a way to use Hiera with defines through the use of the create_resources function. However, that's a more indirect solution.

edit flag offensive delete link more


Hopefully a future version will allow this. I'll accept this answer for now.

llowder gravatar imagellowder ( 2012-12-20 12:09:05 -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: 2012-12-19 15:06:04 -0500

Seen: 212 times

Last updated: Dec 19 '12