does anyone know of a shorter way to do this idiom...
# puppet
c
does anyone know of a shorter way to do this idiom in puppet? I end up repeating it quite often, so if I can find something more compact and elegant that'd be nice:
Copy code
if $elligible_hosts.any |$host| { $facts[networking][fqdn] == $host } {
    $activate_ensure = file
  } else {
    $activate_ensure = absent
  }
In this case it's to determine whether I want to materialise a particular file on a node or not. (I also tried a ternary operator in a selector, but at the time I was just trying to implicitly do the equivalent of
any
between my variable and the fact. maybe I can also do it using the lambda or
member()
, but I admit I haven't tried.)