Added initial support for Debian and Ubuntu to network module
This commit is contained in:
parent
42a3a74b7b
commit
230c2c0e2b
5 changed files with 85 additions and 1 deletions
|
@ -19,10 +19,44 @@ class network::helper::restart {
|
|||
refreshonly => true,
|
||||
}
|
||||
}
|
||||
debian,ubuntu: {
|
||||
exec { "restart-network":
|
||||
command => "/etc/init.d/networking restart",
|
||||
onlyif => "cat /etc/network/interfaces.in /etc/network/interfaces.d/*.conf > /etc/network/interfaces",
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
refreshonly => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Install Debian/Ubuntu specific support files.
|
||||
#
|
||||
class network::helper::debian {
|
||||
|
||||
file { "/etc/network/interfaces.in":
|
||||
ensure => present,
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
source => "puppet:///network/interfaces.in",
|
||||
}
|
||||
|
||||
file { "/etc/network/interfaces.d":
|
||||
ensure => directory,
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
purge => true,
|
||||
force => true,
|
||||
recurse => true,
|
||||
source => "puppet:///custom/empty",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Configure interface.
|
||||
#
|
||||
# === Parameters
|
||||
|
@ -93,6 +127,18 @@ define network::interface($options = [], $ipaddr = "none", $netmask = "none", $i
|
|||
require => File["/etc/sysconfig/network-scripts/ifcfg-${name}"],
|
||||
}
|
||||
}
|
||||
debian,ubuntu: {
|
||||
include network::helper::debian
|
||||
file { "/etc/network/interfaces.d/${name}.conf":
|
||||
ensure => present,
|
||||
content => template("network/interfaces-if.erb"),
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
notify => Exec["restart-network"],
|
||||
require => File["/etc/network/interfaces.d", "/etc/network/interfaces.in"],
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("Network module not supported in ${operatingsystem}")
|
||||
}
|
||||
|
@ -137,6 +183,19 @@ define network::route($gateway, $device) {
|
|||
notify => Exec["restart-network"],
|
||||
}
|
||||
}
|
||||
debian,ubuntu: {
|
||||
include network::helper::restart
|
||||
include network::helper::debian
|
||||
file { "/etc/network/interfaces.d/${device}-gateway.conf":
|
||||
ensure => present,
|
||||
content => template("network/interfaces-gateway.erb"),
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
notify => Exec["restart-network"],
|
||||
require => File["/etc/network/interfaces.d/${device}.conf"],
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("Network module not supported in ${operatingsystem}")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue