class network::debian { exec { "networking": command => "/usr/sbin/invoke-rc.d networking restart", logoutput => true, refreshonly => true, } package {"resolvconf": ensure => installed, } } define network::interface::debian ( $address, $netmask, $broadcast = "NONE", $parameters = "", $auto = true ) { include network::debian $content = template("network/debian.erb") $file = "/etc/network/interfaces" # add an interface line if doesn't exist exec { "add an interface": command => "/bin/echo '${content}' >> $file", unless => "/bin/grep -q '^iface[[:space:]]*${name}[[:space:]]' $file", notify => Exec["networking"] } # XXX: we don't do anything if the file already exists, which means we can't change the IP, for example }