$facts['interfaces'] is a string, not an array. For an array of interface
names, either use $facts['interfaces'].split(',') or
$facts['networking']['interfaces'].keys().
Other than that, your logic should work fine.
On Monday, January 28, 2019 at 3:35:23 PM UTC-6, Abhishek singh wrote:
>
> Hello Group,
>
> I am trying to use facts like interfaces and based on the available
> interfaces perform a common task.
>
> Please help me out for below:
>
> 1. How strings from core facts and local variable can be compared?
>
> For example if interfaces has "eth0, lo, .." and i want to match from it.
>
>
> 1. if ('lo' in $facts['interfaces']) # it is not working but also no
> validation error.
>
>
>
> 2. if ! ($facts['interfaces'] in [ 'lo', 'ens160' ]) # it is not
> working but also no validation error.
>
>
> is it possible to put a condition on facts existence itself?
>
> like if ipaddress_eth0 is then perform action from code/enter in loop.
>
>
> Please help me out.
> Also, Please suggest any links for future understanding.
>
> Thanks.
>
>
--
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/d2191cce-ed39-4e01-a3ad-e6cb363dcd26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.