# loop over elements of array (puppet3 without parser = future)
$str = 'нqwe,?rty+ыasd'
$arr = split($str, ',|\+')
define loop ($arr_elem = $title){
if "$arr_elem" =~ /qwe/ {
notify { "Filtered array element is ${arr_elem}": }
}
}
loop { $arr : }
$int_names = split($::interfaces, ',')
#notice($::interfaces)
#notice($int_names)
#if 'lo' in $int_names {
# notice 'lo is in array'
#}
define offload_disable ($int = $title){
if $int != 'lo' {
exec {"disable_rx_$int":
path => '/bin/:/sbin/',
command => "ethtool -K $int rx off",
onlyif => "ethtool -k $int | egrep 'rx-checksumming: on'",
}
exec { "disable_tx_$int":
path => '/bin/:/sbin/',
command => "ethtool -K $int tx off",
onlyif => "ethtool -k $int | egrep 'tx-checksumming: on'",
}
}
}
offload_disable { $int_names: }
применение одного класса посредством агента:
# puppet agent -t --server=puppet.int --environment dev --tags rsyslog