Thanks, interesting.
Do you use this instead of hiera_include + automatic lookups?

Andrey


On 3 January 2014 16:23, Fabrice Bacchella <[email protected]> wrote:

> I defined a custom ruby function called create_type
>
> Then if in my hiera, I define :
>
> localclasses:
>    - class1:
>          arg1: value
>          arg2: value
>   - class2:
>          arg1: value
>          arg2: value
> - class3
>
> A simple call to :
> $localclasses = hiera_array("localclasses", [])
> create_type("class",   $localclasses) will do the trick.
>
> I use hiera_array to merge many hiera files.
>
> It allows to have very readable hiera files to my taste.
>
> I wrote create_type to have a ressource creation that was not too picky
> about the way it's called.
>
> You need to put create_type.rb in <modules>/lib/puppet/parser/functions
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/0C0BCC51-CB2A-4E74-AA7A-B027B5FC1DB2%40spamcop.net
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> Le 3 janv. 2014 à 15:54, Andrey Kozichev <[email protected]> a écrit :
>
> Hi!
> Couldn't find the answer in the documentation.
> Is it possible to source data from Hiera directly into parametrised
> classes?
>
> To explain:
>
> I have class mcollective(type,middleware_hosts,securityprovider ....)
>
> Can I define all arguments for this class in Hiera and fetch them all in
> one Hiera call and then use to declare the class?
>
> Similar what is done with create_resources for defined type but for Class?
>
>
> Just seems waste to me doing individually:
>
> $type = hiera('mcollective::type')
> $middleware_hosts = hiera('mcollective::middleware_hosts')
>
> and then in the class declaration:
>
> class { '::mcollective':
>
>       type => $type
>
>       middleware_hosts =>  $middleware_hosts
>
>
> Andrey
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CACzr%3DFf9kEP7nzX8D72Kw2Uj_J%3DTgyMO5jkckuYz60qDJE%2BB2A%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CACzr%3DFc0Y0dZgFfWAJZyn-nLnSBp4F-%2BOnR%2BvNQJp3%3DP%2BF5AMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to