[Puppet Users] Hiera autolookup for defined types

Bruno Léon
Tue, 06 Nov 2012 17:04:18 -0000

Hello,

since Puppet 3 hiera is doing auto variable lookup for classes, which in my
view makes the code much clearer simply because we can use
	include foo
instead of
	class { ''foo'':
		param1 => value,
		param2 => value,
	 }

However, AFAIK there is no such feature as auto looking parameters for defined
type.
A common case is multiple vhost in Apache.

Even though you can have apache installed as simply as "include
apache", you
still have a lot of define (one per vhost), possibly each with different
parameters.

Would it be possible to have hiera looking up for a hash of parameters.

Something like this in hiera:

---
apache_vhost:
	website1:
		web_param1: ''foo''
		web_param2: ''bar''
	website2:
		web_param1: ''another_foor''
		web_param2: ''another_bar''

And in the manifest, this would be invoked as simply as:

node "test" {
	include apache
	apache_vhost { ''website1'': }
	apache_vhost { ''website2'': }
}

Any ideas on this ? Any plans of implementation ?

Thanks
--
Bruno