Ask Your Question

How can I use data bindings in Puppet 3?

asked 2012-12-20 00:11:31 -0600

robbyt gravatar image

The documentation about data bindings in Puppet 3 isn't very clear. I opened a ticket about this, and have not gotten a response.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-12-20 13:12:09 -0600

llowder gravatar image

updated 2013-01-09 15:27:01 -0600

In your modules, declare a paramaterized class, such as:

class mymodule::myclass(
  $param1 = 'value',
  $param2 = 'other value',

In your hiera data ( I usually use common.yaml for the defaults) put:

mymodule::myclass::param1: 'value'
mymodule::myclass::param2: 'othervalue'

If you need to change or override it, in a different yaml file (such as <hostname>.yaml or <osfamily>.yaml or however you have your hierarchy setup) you can then do:

mymodule::myclass::param1: 'some other value'

You will also be able to use include syntax for all your node defs, which is a lot cleaner and will let you use it ... (more)

edit flag offensive delete link more


Thanks for the great clarification and examples. I was confused by hiera's handling of booleans, see . If I set a value to false ...(more)

robbyt gravatar imagerobbyt ( 2013-01-09 15:33:10 -0600 )edit

Yeah, that one is an annoying bug. I think I wound up quoting true/false in most cases in the hiera yaml files, and not quoting it in the defaults.

llowder gravatar imagellowder ( 2013-01-09 16:21:37 -0600 )edit

If I'm not mistaken, if you use yes or no unquoted in the yaml files it evaluates to true or false.

Daenney gravatar imageDaenney ( 2013-03-08 07:55:36 -0600 )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-20 00:11:31 -0600

Seen: 2,650 times

Last updated: Jan 09 '13