try $VARIABLE ='(host1|host2|host3)'
$testing = $::hostname ? {
    /$VARIABLE/  => 'filetest',
    default    => 'file',
  }


On 15 January 2014 11:19, Francisco José Bejarano <fjbejar...@gmail.com>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 puppet-users+unsubscr...@googlegroups.com.
> 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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CACzr%3DFfBKjFTXjYq7ODvGSPGJeqRgCbM6-S1W1g8RMAEYvJP4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to