Ask Your Question

Revision history [back]

What is the variable format for autolookups for defines?

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 am not sure what else to try.

What is the variable format for autolookups for defines?

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 am not sure what else to try.try, and would appreciate someone letting me know how to structure that hiera data.