just asan informational note, look at the manifest I attached. I'm
using it to add tunl0 devices.
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
class network
{
# Requires xen modules package on Debian. See debian_based_os.pp
define tunnel( $device, $rip_iface="eth0", $family="inet", $method="static",
$address, $broadcast="255.255.255.255", $netmask="255.255.255.255",
$mtu="1480", $state="down")
{
$mtu_param = $ethernetcontroller ? {
/Broadcom Corporation NetXtreme II/ => "ip_lvs_mtu 1",
default => "mtu ${mtu}",
}
augeas { "auto_${device}":
context => "/files/etc/network/interfaces",
changes => [
"set auto[last()+1]/1 ${device}",
],
onlyif => "match auto/*[ . = 'tunl0'] size == 0",
}
augeas { "tunnel_${name}":
context => "/files/etc/network/interfaces",
changes => [
"set iface[ . = '${device}'] ${device}",
"set iface[ . = '${device}']/family ${family}",
"set iface[ . = '${device}']/method ${method}",
"set iface[ . = '${device}']/address ${address}",
"set iface[ . = '${device}']/broadcast ${broadcast}",
"set iface[ . = '${device}']/netmask ${netmask}",
"set iface[ . = '${device}']/ip_rp_filter 0",
"set iface[ . = '${rip_iface}']/ip_hide_arp 1",
"set iface[ . = '${rip_iface}']/ip_rp_filter 0",
"set iface[ . = '${rip_iface}']/$mtu_param",
],
}
Augeas["auto_${device}"] -> Augeas["tunnel_${name}"]
case $state{
'down' :
{
exec {
"bringdown":
command => "/sbin/ifdown $device",
onlyif => "/sbin/ifconfig | /bin/grep -q $device"
}
Augeas["tunnel_${name}"] -> Exec["bringdown"]
}
'up' :
{
exec {
"bringup":
command => "/sbin/ifup $device",
unless => "/sbin/ifconfig | /bin/grep -q $device"
}
Augeas["tunnel_${name}"] -> Exec["bringup"]
}
default:
{
abort("Invalid state $state")
}
}
}
}