Created
May 13, 2013 20:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/puppet/modules/netif/manifests/eth.pp | |
# handle ethernet and VLAN ethernet device type configuration | |
# | |
define netif::eth ($ifaddr = "", $ifaddr6 = "", $aliases = [], $aliases6 = [], $onboot = "yes" , $mtu) | |
{ | |
$ifname = $name | |
# filename | |
$eth_file = "/etc/sysconfig/network-scripts/ifcfg-${ifname}" | |
# set up regular eth ifcfg file | |
file { "$eth_file": | |
mode => 644 , | |
owner => root , | |
group => root , | |
# backup => sysconfig | |
ensure => file , | |
content => template("netif/eth.erb"), | |
notify => Service[network] , | |
} | |
} | |
define netif::eth_vlan ($ifaddr = "", $onboot = "yes" , $mtu) | |
{ | |
$ifname = $name | |
# filename | |
$eth_file = "/etc/sysconfig/network-scripts/ifcfg-${ifname}" | |
# set up vlan eth ifcfg file | |
file { "$eth_file": | |
mode => 644 , | |
owner => root , | |
group => root , | |
# backup => sysconfig | |
ensure => file , | |
content => template("netif/eth_vlan.erb"), | |
notify => Service[network] , | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/puppet/modules/netif/manifests/ib.pp | |
# handle infiniband and infiniband with pkey device type configuration | |
# | |
define netif::ib ($ifaddr = "", $onboot = "yes" , $mtu = "2044" ) | |
{ | |
$ifname = $name | |
# filename | |
$ib_file = "/etc/sysconfig/network-scripts/ifcfg-${ifname}" | |
# set up ib ifcfg file | |
file { "$ib_file": | |
mode => 644 , | |
owner => root , | |
group => root , | |
# backup => sysconfig | |
ensure => file , | |
content => template("netif/ib.erb"), | |
notify => [ Service[network] , Service[openibd] ] , | |
} | |
} | |
define netif::ib_pkey ($ifaddr = "", $onboot = "yes" , $mtu = "2044") | |
{ | |
$ifname = $name | |
# filename | |
$ib_file = "/etc/sysconfig/network-scripts/ifcfg-${ifname}" | |
# set up pkey ib ifcfg file | |
file { "$ib_file": | |
mode => 644 , | |
owner => root , | |
group => root , | |
# backup => sysconfig | |
ensure => file , | |
content => template("netif/ib_pkey.erb"), | |
notify => [ Service[network] , Service[openibd] ] , | |
} | |
} | |
~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/puppet/modules/netif/manifests/init.pp | |
# Set up network interface configurations for Exegy systems | |
# | |
# | |
class netif { | |
# include stdlib | |
# other stuff depends on network service | |
service { "network" : | |
ensure => true , | |
enable => true , | |
} | |
# add openib service if we have an ib interface | |
if ($::interfaces =~ /ib/) { | |
service { "openibd" : | |
ensure => true , | |
enable => true , | |
} | |
} | |
} | |
# interface reusable type | |
# default MTU is set in the individual interface defined types | |
define netif::interface ( | |
$ifaddr = "", | |
$ifaddr6 = "", | |
$aliases = [], | |
$aliases6 = [], | |
$slaves = [] , | |
$onboot = "yes", | |
$onparent = "yes" , | |
$mtu, | |
$routes = undef, | |
$routes6 = undef ) | |
{ | |
# switch on interface name | |
case $name { | |
# catch alias first since it might match other stuff | |
/^.*:.*$/ : { | |
netif::alias { $name : | |
ifaddr => $ifaddr , | |
onparent => $onparent , | |
mtu => $mtu, | |
} | |
} | |
# regular ethernet interface. | |
/^eth\d+$/ : { | |
netif::eth { $name : | |
ifaddr => $ifaddr , | |
mtu => $mtu, | |
ifaddr6 => $ifaddr6 , | |
aliases => $aliases , | |
aliases6 => $aliases6 , | |
} | |
} | |
# vlan ethernet interface. | |
/^eth\d+\.\d+$/ : { | |
netif::eth_vlan { $name : | |
ifaddr => $ifaddr , | |
mtu => $mtu, | |
} | |
} | |
# regular ib interface. | |
/^ib\d+$/ : { | |
netif::ib { $name : | |
ifaddr => $ifaddr , | |
mtu => $mtu, | |
} | |
} | |
# partitioned ib interface. | |
/^ib\d+\.\d+$/ : { | |
netif::ib_pkey { $name : | |
ifaddr => $ifaddr , | |
mtu => $mtu, | |
} | |
} | |
# bridge interface | |
/^br\d+$/ : { | |
netif::br { $name : | |
ifaddr => $ifaddr , | |
slaves => $slaves , | |
mtu => $mtu, | |
} | |
} | |
# tap interface | |
/^tap\d+$/ : { | |
netif::tap { $name : | |
ifaddr => $ifaddr , | |
mtu => $mtu, | |
} | |
} | |
# default case do nothing | |
default : { notify {"netif: interface type ${name} not found.":} } | |
} | |
# make route files | |
if !empty($routes) { | |
netif::route { $name : | |
routes => $routes | |
} | |
} | |
if !empty($routes6) { | |
netif::route6 { $name : | |
routes => $routes6 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment