[510] | 1 | import "network/os/*.pp" |
---|
| 2 | |
---|
| 3 | class network { |
---|
| 4 | |
---|
| 5 | } |
---|
| 6 | |
---|
| 7 | # configure an interface with the given options |
---|
| 8 | # $parameters are platform dependent extras |
---|
| 9 | define network::interface ( $address, $netmask, $broadcast = "NONE", $parameters = "" ) { |
---|
| 10 | case $operatingsystem { |
---|
| 11 | OpenBSD: { |
---|
| 12 | network::interface::openbsd { $name: |
---|
[642] | 13 | address => $address, |
---|
| 14 | netmask => $netmask, |
---|
| 15 | broadcast => $broadcast, |
---|
[510] | 16 | parameters => $parameters, |
---|
| 17 | } |
---|
| 18 | } |
---|
| 19 | Debian: { |
---|
| 20 | network::interface::debian { $name: |
---|
[642] | 21 | address => $address, |
---|
| 22 | netmask => $netmask, |
---|
| 23 | broadcast => $broadcast, |
---|
[510] | 24 | parameters => $parameters, |
---|
| 25 | } |
---|
| 26 | } |
---|
| 27 | Ubuntu: { |
---|
| 28 | network::interface::debian { $name: |
---|
[642] | 29 | address => $address, |
---|
| 30 | netmask => $netmask, |
---|
| 31 | broadcast => $broadcast, |
---|
[510] | 32 | parameters => $parameters, |
---|
| 33 | } |
---|
[642] | 34 | case $lsbdistcodename { |
---|
| 35 | Lucid: { |
---|
| 36 | # Por bug: https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/448095 |
---|
| 37 | # Recargamos nuevamente las placas de red |
---|
| 38 | $rclocal = "/etc/init.d/rc.local" |
---|
| 39 | file { "$rclocal" : ensure => present, } |
---|
| 40 | line { "cambiamos rc.local": |
---|
| 41 | file => "$rclocal" , |
---|
| 42 | line => "ifdown -a; ifup -a", |
---|
| 43 | ensure => present, |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | } |
---|
[510] | 49 | default: { |
---|
| 50 | err("Network interface configuration not supported in $operatingsystem") |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | # configure a tagged vlan on the given interface |
---|
| 56 | define network::vlan ( $vtag, $device, $address, $netmask, $broadcast = "NONE", $parameters = "" ) { |
---|
| 57 | case $operatingsystem { |
---|
| 58 | OpenBSD: { |
---|
| 59 | network::interface { $name: |
---|
[642] | 60 | address => $address, |
---|
| 61 | netmask => $netmask, |
---|
| 62 | broadcast => $broadcast, |
---|
[510] | 63 | parameters => "vlan $vtag vlandev $device $parameters" |
---|
| 64 | } |
---|
| 65 | } |
---|
| 66 | default: { |
---|
| 67 | err("VLANs not supported in $operatingsystem") |
---|
| 68 | } |
---|
| 69 | } |
---|
| 70 | } |
---|