Last active
December 24, 2015 03:09
-
-
Save xarses/6735337 to your computer and use it in GitHub Desktop.
Openstack-Fuel site.pp snippet for bonding
This file contains 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
#Network configuration | |
stage {'netconfig': | |
before => Stage['main'], | |
} | |
class {'l23network': stage=> 'netconfig'} | |
class node_netconfig ( | |
$mgmt_ipaddr, | |
$mgmt_netmask = '255.255.255.0', | |
$private_ipaddr = undef, | |
$public_ipaddr = undef, | |
$public_netmask = '255.255.0.0', | |
$private_netmask = '255.255.0.0', | |
$save_default_gateway=false, | |
$quantum = $quantum, | |
) { | |
l23network::l3::create_br_iface {'mgmt': | |
interface => $internal_interface, | |
bridge => $internal_br, | |
ipaddr => $mgmt_ipaddr, | |
netmask => $mgmt_netmask, | |
dns_search=> $nodes_domain, | |
dns_nameservers => $dns_nameservers, | |
save_default_gateway => $save_default_gateway, | |
} | |
l23network::l3::ifconfig {'bond0': | |
ipaddr => 'none', | |
bond_mode => 4, | |
bond_miimon => 100, | |
bond_lacp_rate => 1, | |
} -> | |
l23network::l3::ifconfig {'eth2': ipaddr=>'none', bond_master=>'bond0', } -> | |
l23network::l3::ifconfig {'eth3': ipaddr=>'none', bond_master=>'bond0', } -> | |
l23network::l3::create_br_iface {'ex': | |
interface => $public_interface, | |
bridge => $public_br, | |
ipaddr => $public_ipaddr, | |
netmask => $public_netmask, | |
gateway => $default_gateway, | |
dns_search=> $nodes_domain, | |
interface_vlandev => 'bond0', | |
} | |
l23network::l3::ifconfig {'vlan100': | |
ipaddr => 'none', | |
vlandev => 'bond0', | |
} | |
} |
This file contains 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
$internal_interface = "bond0" | |
$internal_br = 'br-mgmt' | |
#Network configuration | |
stage {'netconfig': | |
before => Stage['main'], | |
} | |
class {'l23network': use_ovs=>$quantum, stage=> 'netconfig'} | |
class node_netconfig ( | |
$mgmt_ipaddr, | |
$mgmt_netmask = '255.255.255.0', | |
$public_ipaddr = undef, | |
$public_netmask= '255.255.254.0', | |
$save_default_gateway=false, | |
$quantum = $quantum, | |
) { | |
if ($::hostname in $controller_hostnames) { | |
l23network::l3::ifconfig {'eth0': | |
ipaddr => 'none', | |
} -> | |
l23network::l3::ifconfig {'eth1': | |
ipaddr => 'none', | |
} -> | |
l23network::l3::ifconfig {'eth2': | |
ipaddr => 'none', | |
} -> | |
l23network::l3::ifconfig {'eth3': | |
ipaddr => 'none', | |
} -> | |
l23network::l2::bridge{$internal_int: } -> | |
l23network::l2::bond{'bond0': | |
bridge => $internal_int, | |
ports => [ 'eth0', 'eth1', 'eth2', 'eth3' ], | |
properties => [ 'trunks=0,1000' ], | |
} -> | |
l23network::l3::ifconfig {$internal_int: | |
ipaddr => $mgmt_ipaddr, | |
netmask => $mgmt_netmask, | |
} -> | |
exec {"ovs-real-$public_int": | |
path => '/usr/bin:/usr/sbin:/bin:/sbin', | |
command => "ovs-vsctl add-br br-ex br-mgmt 1000 | true", | |
creates => "/etc/network/interfaces.d/ifcfg-br-ex", | |
} -> | |
l23network::l3::ifconfig {$public_int: | |
ipaddr => $public_ipaddr, | |
netmask => $public_netmask, | |
gateway => $default_gateway, | |
dns_search=> $nodes_domain, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment