Fixed network config updating on Ubuntu

This commit is contained in:
Ossi Salmi 2011-03-09 14:02:48 +02:00 committed by Timo Mkinen
parent 03ae395388
commit 0a11cf20aa

View file

@ -21,8 +21,8 @@ class network::helper::restart {
} }
debian,ubuntu: { debian,ubuntu: {
exec { "restart-network": exec { "restart-network":
command => "/etc/init.d/networking restart", cwd => "/etc/network",
onlyif => "cat /etc/network/interfaces.in /etc/network/interfaces.d/*.conf > /etc/network/interfaces", command => "cat interfaces.in interfaces.d/*.conf > interfaces && /etc/init.d/networking restart",
path => "/bin:/usr/bin:/sbin:/usr/sbin", path => "/bin:/usr/bin:/sbin:/usr/sbin",
refreshonly => true, refreshonly => true,
} }
@ -129,7 +129,7 @@ define network::interface($options = [], $ipaddr = "none", $netmask = "none", $i
} }
debian,ubuntu: { debian,ubuntu: {
include network::helper::debian include network::helper::debian
file { "/etc/network/interfaces.d/${name}.conf": file { "/etc/network/interfaces.d/${name}-addr.conf":
ensure => present, ensure => present,
content => template("network/interfaces-if.erb"), content => template("network/interfaces-if.erb"),
mode => 0644, mode => 0644,
@ -186,14 +186,14 @@ define network::route($gateway, $device) {
debian,ubuntu: { debian,ubuntu: {
include network::helper::restart include network::helper::restart
include network::helper::debian include network::helper::debian
file { "/etc/network/interfaces.d/${device}-gateway.conf": file { "/etc/network/interfaces.d/${device}-gate.conf":
ensure => present, ensure => present,
content => template("network/interfaces-gateway.erb"), content => template("network/interfaces-gateway.erb"),
mode => 0644, mode => 0644,
owner => root, owner => root,
group => root, group => root,
notify => Exec["restart-network"], notify => Exec["restart-network"],
require => File["/etc/network/interfaces.d/${device}.conf"], require => File["/etc/network/interfaces.d/${device}-addr.conf"],
} }
} }
default: { default: {