On Apr 10, 9:58 am, Jeff <jixe...@hotmail.com> wrote:
> Many thanks to you John and Nan.  Using the hiera_hash function provides
> the desired behavior and it effectively replaced the need for resource
> capitalization for my use case.
>
> One last thing Im puzzled with if I may:  A more complex use case where a
> parameter has to be set based on 2 criterias together on the same hiera
> level,  lets say 'os' and 'role' (like a sysctl for an app server under
> rhel4 vs rhel5 ),  how would you solve this ?
>
> ---
> :hierarchy:
>     - %{fqdn}
>     - %{environnement}
>     - %{datacenter}
>     - %{os}
>     - %{role}
>     - common


I think the %{foo} syntax is just doing a text interpolation, so you
should be able to define a level such as
    - %{os}_%{role}

I would try to resist doing so, however, because a simpler hierarchy
will be easier to maintain, and also because of the combinatorial
implications.  You might find that you can instead combine separate
pieces of data from your %{os} and %{role} levels inside your
manifests (or templates) to construct the target value.

Do not neglect the possibilities inherent in hiera's support for
complex data types.  For example, one of the items in your %{os} data
could be a *table* (as a hash) of possible target values for some
property.  Then your %{role} data could specify which key into that
table to use to select the appropriate value for the os/role
combination.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to