Puppet practical: check $interfaces for IP address

EXAMPLE on checking IP Address on available network interfaces (via Puppet)

$ifs = split($interfaces, ‘,’)
notify {” Interface list: $ifs “: }
defines::show_ip_test { $ifs: }

define show_ip_test {
$inf = “ipaddress_${name}”
$ip = inline_template(‘<%= scope.lookupvar(inf) %>’)
#            notify {“IP ${name} :  $ip”: }
if $ip =~ /^153\.100\.[3-6]{1}\.*/ {
#             if $ip =~ /10\.182\.42.*/ {
notify {“Found at ${name} matching IP: $ip”: }
}
}

SOURCE

http://serverfault.com/questions/325591/puppet-checking-sets-of-variables