Added support for bridge interfaces on Centos and Fedora
This commit is contained in:
parent
c64947271f
commit
6013834928
2 changed files with 17 additions and 2 deletions
|
@ -112,6 +112,8 @@ class network::hostname {
|
|||
# Defaults to none.
|
||||
# $ip6netmask:
|
||||
# IPv6 netmask length. Defaults to 64.
|
||||
# $bridge:
|
||||
# Array of interfaces to add to bridge.
|
||||
# $options:
|
||||
# Custom options for interface (used only on OpenBSD).
|
||||
# $postcmd:
|
||||
|
@ -125,7 +127,9 @@ class network::hostname {
|
|||
# netmask => "255.255.0.0",
|
||||
# }
|
||||
#
|
||||
define network::interface($options = [], $ipaddr = "none", $eaddr = "none", $netmask = "none", $ip6addr = "none", $ip6netmask = "64", $postcmd = []) {
|
||||
define network::interface($ipaddr = "none", $eaddr = "none", $netmask = "none",
|
||||
$ip6addr = "none", $ip6netmask = "64",
|
||||
$bridge = [], $options = [], $postcmd = []) {
|
||||
|
||||
include network::helper::restart
|
||||
|
||||
|
@ -162,6 +166,12 @@ define network::interface($options = [], $ipaddr = "none", $eaddr = "none", $net
|
|||
}
|
||||
}
|
||||
centos,fedora: {
|
||||
if $bridge {
|
||||
network::interface { $bridge:
|
||||
options => [ "BRIDGE=${name}", "LINKDELAY=10" ],
|
||||
before => Exec["restart-interface-${name}"],
|
||||
}
|
||||
}
|
||||
file { "/etc/sysconfig/network-scripts/ifcfg-${name}":
|
||||
ensure => present,
|
||||
content => template("network/ifcfg-if.erb"),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
DEVICE=<%= name %>
|
||||
<% if name !~ /bond[0-9]/ && has_variable?("macaddress_" + name) -%>
|
||||
<% if name !~ /(bond|br)[0-9]/ && has_variable?("macaddress_" + name) -%>
|
||||
HWADDR=<%= scope.lookupvar("macaddress_" + name) %>
|
||||
<% end -%>
|
||||
ONBOOT=yes
|
||||
|
@ -23,6 +23,11 @@ IPV6INIT=yes
|
|||
IPV6ADDR=<%= ip6addr %>/<%= ip6netmask %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% if name =~ /br[0-9]/ -%>
|
||||
TYPE=Bridge
|
||||
DELAY=0
|
||||
LINKDELAY=10
|
||||
<% end -%>
|
||||
<% options.each do |val| -%>
|
||||
<%= val %>
|
||||
<% end -%>
|
||||
|
|
Loading…
Add table
Reference in a new issue