With this runs
hiera yaml
HOSTS_TESTING:
- 'host1'
- 'host2'
- 'host3'
and manifest
$HOSTS_TESTING = hiera_array('HOSTS_TESTING')
if $::hostname in $HOSTS_TESTING {
$testing = 'filetest'
} else {
$testing = 'file'
}
El miércoles, 15 de enero de 2014 14:11:09 UTC+1, Francisco José Bejarano
escribió:
>
> Not runs
>
> I have tried with all combinatios of quotes, arrays, hiera, etc. Only runs
> with literal values in the expression even I have replaced the selector
> with if statement
>
> if $::hostname [ $variable ] {
>
> and neither runs only with literal values
>
> if $::hostname [ "host1","host2","host3" ] {
>
> If anyone knows how it is done...
>
> El miércoles, 15 de enero de 2014 13:20:20 UTC+1, Andrew escribió:
>>
>> try $VARIABLE ='(host1|host2|host3)'
>> $testing = $::hostname ? {
>> /$VARIABLE/ => 'filetest',
>> default => 'file',
>> }
>>
>>
>> On 15 January 2014 11:19, Francisco José Bejarano <[email protected]>wrote:
>>
>>> Greetings to all
>>>
>>> I have a question about the use of selectors. I am using 3.4.2
>>>
>>> I have this selector in my code
>>>
>>> $testing = $::hostname ? {
>>> /(host1|host2|host3)/ => 'filetest',
>>> default => 'file',
>>> }
>>>
>>> I would like to use a variable as a multiple expression in a selectorlike
>>> this
>>>
>>> $VARIABLE ='/(host1|host2|host3)/'
>>>
>>> $testing = $::hostname ? {
>>> $VARIABLE => 'filetest',
>>> default => 'file',
>>> }
>>>
>>> ¿Is that possible?
>>>
>>> I've tried different ways but does not work. With quotes, without quotes
>>> , etc.. It always select the default file (file) if I put variable, but
>>> if I do not put variable (first code) it works ok and FileTest is used
>>> if hostname is in expression.
>>>
>>> I would like to use VARIABLE in hiera to use the name of hosts (not in
>>> hard code)
>>>
>>> ¿Is that possible?
>>>
>>> Thanks in advance :-)
>>>
>>> --
>>> 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/5eecc840-5ab9-4636-a9be-492e8f65250c%40googlegroups.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/f300c13d-ad8f-485b-9d13-eeb8d3099227%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.