Hiera is called each time you query it, or because of  the auto lookup, so
if you set up a role variable in site.pp you can use it in next queries.

I use this method ;)
El 09/09/2014 23:03, "JeremyCampbell" <[email protected]> escribió:

> I would expect that the role has to be set before hiera is queried or am I
> missing something? I don't understand how that would work.
>
> On Tuesday, September 9, 2014 8:11:08 PM UTC+2, Jose Luis Ledesma wrote:
>>
>> You can hace %{role} in your hierarchy setting in your site.pp:
>>
>> $role=hiera('role')
>>
>> Regards
>> El 09/09/2014 11:34, "JeremyCampbell" <[email protected]> escribió:
>>
>>>  We are implementing the profiles/roles pattern with hiera and using
>>> hiera to assign roles i.e. hiera_include('classes'). Current hierarchy:
>>>
>>> :hierarchy:
>>>   - "%{clientcert}"
>>>   - "%{environment}"
>>>   - global
>>>
>>> We have several roles which require their own configuration data. e.g.
>>> Firewall role, VPN role (each include several profiles). For example, using
>>> the logrotate module we need to add different defines for the Firewall role
>>> and the VPN role.
>>>
>>>  The most obvious solution is to create a new hierarchy level e.g.
>>> "%{role}" but then we need to assign machines to a role outside of hiera.
>>> I'm guessing the best way to do this is with a custom fact during the
>>> initial provisioning but I'm not sure.
>>>
>>> What would be the best solution for looking up role specific data using
>>> the roles/profiles pattern with hiera?
>>>
>>> Thank you for your time!
>>>
>>>
>>>
>>> --
>>> 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/6510ddf4-2a0b-4a1e-abb8-8d0244ba48f3%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/puppet-users/6510ddf4-2a0b-4a1e-abb8-8d0244ba48f3%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> 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/08a5666e-e035-46b3-8e9a-7fec33ceda18%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/08a5666e-e035-46b3-8e9a-7fec33ceda18%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAF_B3dckZDpOwBrNWaVyu0rmb2Z76%2BzctYGZEKJNOqwJPfSrgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to