diff --git a/LICENSE b/LICENSE index f938647..a7cb00b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,14 +1,14 @@ - Copyright 2014 T Repasi + Copyright 2016 T Repasi Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/manifests/iface.pp b/manifests/iface.pp index 075610f..2f3689f 100644 --- a/manifests/iface.pp +++ b/manifests/iface.pp @@ -1,295 +1,295 @@ # == Define: iface # # Resource to define an interface configuration stanza within interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*method*] - string # Configuration method to be used. Supported methods are: # * loopback # * dhcp # * static # * manual # * wvdial # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*hostname*] - string # The hostname to be submitted with dhcp requests. # # [*leasetime*] - int # The requested leasetime of dhcp leases. # # [*vendor*] - string # The vendor id to be submitted with dhcp requests. # # [*client*] - string # The client id to be submitted with dhcp requests. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*address*] - string # IP address formatted as dotted-quad for IPv4. # # [*netmask*] - string # Netmask as dotted-quad or CIDR prefix length. # # [*broadcast*] - string # Broadcast address as dotted-quad or + or -. # # [*gateway*] - string # Default route to be brought up with this interface. # # [*pointopoint*] - stirng # Address of the ppp endpoint as dotted-quad. # # [*mtu*] - int # Size of the maximum transportable unit over this interface. # # [*scope*] - string # Scope of address validity. Values allowed are global, link or host. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # [*tx_queue*] - int # Feature helper for setting tx queue on the interface. # # [*routes*] - hash # Feature helper for setting static routes via the interface. # # [*dns_nameserver*] - array # Feature helper to add a list of nameservers to be configures via resolvconf # while the interface is set up. # # [*dns_search*] - array # Feature helper to add a list of domain names as dns search via resolvconf # while the interface is set up. # # === Authors # # Tibor Repasi # # === Copyright # -# Copyright 2015 Tibor Repasi +# Copyright 2016 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface ( $method, $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, # options for multiple methods $metric = undef, $hwaddress = undef, # options for method dhcp $hostname = undef, $leasetime = undef, $vendor = undef, $client = undef, # options for method static $address = undef, $netmask = undef, $broadcast = undef, $gateway = undef, $pointopoint = undef, $mtu = undef, $scope = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, # feature-helpers $tx_queue = undef, $routes = {}, $dns_nameservers = undef, $dns_search = undef, ) { include debnet validate_string($ifname) validate_bool($auto) validate_array($allows) validate_re($family, '^inet$' ) validate_re($method, '^loopback$|^dhcp$|^static$|^manual$|^wvdial$') validate_hash($aux_ops) validate_array($pre_ups) validate_array($ups) validate_array($downs) validate_array($post_downs) if $tx_queue { if is_string($tx_queue) { validate_re($tx_queue, '^\d+$') } else { validate_integer($tx_queue) } } if $routes { validate_hash($routes) } if $dns_nameservers { validate_array($dns_nameservers) } if $dns_search { validate_array($dns_search) } case $method { 'loopback' : { concat::fragment { 'lo_stanza': target => $debnet::params::interfaces_file, content => template('debnet/loopback.erb'), order => 20 + $order, } } 'dhcp' : { if !defined(Package[$debnet::params::dhclient_pkg]) { package { $debnet::params::dhclient_pkg: ensure => 'installed', } } if $hostname { validate_re($hostname, '^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{,63}(? $debnet::params::interfaces_file, content => template( 'debnet/iface_header.erb', 'debnet/inet_dhcp.erb', 'debnet/iface_aux.erb', 'debnet/iface_routes.erb'), order => 30 + $order, } } 'static' : { validate_re($address, '^(:?[0-9]{1,3}\.){3}[0-9]{1,3}$') if is_string($netmask) { validate_re($netmask, '^([0-9]{1,3}\.){3}[0-9]{1,3}$|^[0-9]{1,2}$') } else { validate_integer($netmask) } if $broadcast { validate_re($broadcast, '^([0-9]{1,3}\.){3}[0-9]{1,3}$|^[+-]$') } if $metric { validate_re($metric, '^\d+$') } if $gateway { validate_re($gateway, '(:?[0-9]{1,3}\.){3}[0-9]{1,3}$') } if $pointopoint { validate_re($pointopoint, '(:?[0-9]{1,3}\.){3}[0-9]{1,3}$') } if $hwaddress { validate_re($hwaddress, '^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$') } if $mtu { validate_re($mtu, '^\d+$') } if $scope { validate_re($scope, '^global$|^link$|^host$') } concat::fragment { "${ifname}_stanza": target => $debnet::params::interfaces_file, content => template( 'debnet/iface_header.erb', 'debnet/inet_static.erb', 'debnet/iface_aux.erb', 'debnet/iface_routes.erb'), order => 40 + $order, } } 'manual' : { concat::fragment { "${ifname}_stanza": target => $debnet::params::interfaces_file, content => template( 'debnet/iface_header.erb', 'debnet/inet_misc.erb', 'debnet/iface_aux.erb'), order => 50 + $order, } } 'wvdial' : { if !defined(Package[$debnet::params::wvdial_pkg]) { package { $debnet::params::wvdial_pkg: ensure => 'installed', } } concat::fragment { "${ifname}_stanza": target => $debnet::params::interfaces_file, content => template( 'debnet/iface_header.erb', 'debnet/inet_misc.erb', 'debnet/iface_aux.erb', 'debnet/iface_routes.erb'), order => 60 + $order, } } default: { err('unrecognized method') } } } diff --git a/manifests/iface/bond.pp b/manifests/iface/bond.pp index 8ddf7ed..e0383e6 100644 --- a/manifests/iface/bond.pp +++ b/manifests/iface/bond.pp @@ -1,284 +1,284 @@ # == Define: iface::bond # # Resource to define a bonding interface configuration stanza within # interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*method*] - string # Configuration method to be used. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*hostname*] - string # The hostname to be submitted with dhcp requests. # # [*leasetime*] - int # The requested leasetime of dhcp leases. # # [*vendor*] - string # The vendor id to be submitted with dhcp requests. # # [*client*] - string # The client id to be submitted with dhcp requests. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*address*] - string # IP address formatted as dotted-quad for IPv4. # # [*netmask*] - string # Netmask as dotted-quad or CIDR prefix length. # # [*broadcast*] - string # Broadcast address as dotted-quad or + or -. # # [*gateway*] - string # Default route to be brought up with this interface. # # [*pointopoint*] - stirng # Address of the ppp endpoint as dotted-quad. # # [*mtu*] - int # Size of the maximum transportable unit over this interface. # # [*scope*] - string # Scope of address validity. Values allowed are global, link or host. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops_*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # [*tx_queue*] - int # Feature helper for setting tx queue on the interface. # # [*routes*] - hash # Feature helper for setting static routes via the interface. # # [*dns_nameserver*] - array # Feature helper to add a list of nameservers to be configures via resolvconf # while the interface is set up. # # [*dns_search*] - array # Feature helper to add a list of domain names as dns search via resolvconf # while the interface is set up. # # === Authors # # Tibor Repasi # # === Copyright # -# Copyright 2015 Tibor Repasi +# Copyright 2016 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::bond( $method, $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, # bond options $ports = [], $mode = 'active-backup', $miimon = 100, $use_carrier = true, $updelay = undef, $downdelay = undef, # options for multiple methods $metric = undef, $hwaddress = undef, # options for method dhcp $hostname = undef, $leasetime = undef, $vendor = undef, $client = undef, # options for method static $address = undef, $netmask = undef, $broadcast = undef, $gateway = undef, $pointopoint = undef, $mtu = undef, $scope = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops_master = {}, $aux_ops_slaves = {}, # feature-helpers $tx_queue = undef, $routes = {}, $dns_nameservers = undef, $dns_search = undef, ) { include debnet if !defined(Package[$debnet::params::ifenslave_pkg]) { package { $debnet::params::ifenslave_pkg: ensure => 'installed', } } validate_array($ports) if size($ports) == 0 { fail('Bonding needs at least one port to be declared!') } # lint:ignore:80chars validate_re($mode, '^balance\-rr$|^active\-backup$|^balance\-xor$|^broadcast$|^802\.3ad$|^balance\-tlb$|^balance\-alb$') # lint:endignore if is_string($miimon) { validate_re($miimon, '^\d+$') } else { validate_integer($miimon) } $bondopts0 = { 'bond-slaves' => 'none', 'bond-primary' => $ports[1], 'bond-mode' => $mode, 'bond-miimon' => $miimon, } validate_bool($use_carrier) if $updelay { if is_string($updelay) { validate_re($updelay, '^\d+$') } else { validate_integer($updelay) } $bondopts1 = {'bond-updelay' => $updelay} } else { $bondopts1 = {} } if $downdelay { if is_string($downdelay) { validate_re($downdelay, '^\d+$') } else { validate_integer($downdelay) } $bondopts2 = {'bond-downdelay' => $downdelay} } else { $bondopts2 = {} } debnet::iface { $ports: method => 'manual', auto => $auto, allows => $allows, family => $family, order => 50 + $order, mtu => $mtu, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => merge( $aux_ops_slaves, { 'bond-master' => $ifname, 'bond-mode' => $mode, 'bond-primary' => $ports[1], } ), tx_queue => $tx_queue, } debnet::iface { $ifname: method => $method, auto => $auto, allows => $allows, family => $family, order => 60 + $order, metric => $metric, hwaddress => $hwaddress, hostname => $hostname, leasetime => $leasetime, vendor => $vendor, client => $client, address => $address, netmask => $netmask, broadcast => $broadcast, gateway => $gateway, pointopoint => $pointopoint, mtu => $mtu, scope => $scope, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => merge( $aux_ops_master, $bondopts0, $bondopts1, $bondopts2 ), tx_queue => $tx_queue, routes => $routes, dns_nameservers => $dns_nameservers, dns_search => $dns_search, } } \ No newline at end of file diff --git a/manifests/iface/bridge.pp b/manifests/iface/bridge.pp index bb019a1..093808f 100644 --- a/manifests/iface/bridge.pp +++ b/manifests/iface/bridge.pp @@ -1,286 +1,286 @@ # == Define: iface::bridge # # Resource to define a bridge interface configuration stanza within # interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*method*] - string # Configuration method to be used. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*hostname*] - string # The hostname to be submitted with dhcp requests. # # [*leasetime*] - int # The requested leasetime of dhcp leases. # # [*vendor*] - string # The vendor id to be submitted with dhcp requests. # # [*client*] - string # The client id to be submitted with dhcp requests. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*address*] - string # IP address formatted as dotted-quad for IPv4. # # [*netmask*] - string # Netmask as dotted-quad or CIDR prefix length. # # [*broadcast*] - string # Broadcast address as dotted-quad or + or -. # # [*gateway*] - string # Default route to be brought up with this interface. # # [*pointopoint*] - stirng # Address of the ppp endpoint as dotted-quad. # # [*mtu*] - int # Size of the maximum transportable unit over this interface. # # [*scope*] - string # Scope of address validity. Values allowed are global, link or host. # # [*ports*] - array # Array of ports to be added to the bridge. # # [*stp*] - bool # Sets if bridge should implement spanning tree protocol. # # [*prio*] - int # Priority of the bridge for root selection within spanning tree. # # [*fwdelay*] - int # Sets the forward delay of the bridge in seconds. # # [*hello*] - int # Sets the bridge hello time in seconds. # # [*maxage*] - int # Maximum seconds of age of STP message. # # [*maxwait*] - int # Maximum seconds to wait for bridge interfaces to come up. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # [*tx_queue*] - int # Feature helper for setting tx queue on the interface. # # [*routes*] - hash # Feature helper for setting static routes via the interface. # # [*dns_nameserver*] - array # Feature helper to add a list of nameservers to be configures via resolvconf # while the interface is set up. # # [*dns_search*] - array # Feature helper to add a list of domain names as dns search via resolvconf # while the interface is set up. # # === Authors # # Tibor Repasi # # === Copyright # -# Copyright 2015 Tibor Repasi +# Copyright 2016 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::bridge( $method, $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, # bridge options $ports = [], $stp = false, $prio = undef, $fwdelay = undef, $hello = undef, $maxage = undef, $maxwait = undef, # options for multiple methods $metric = undef, $hwaddress = undef, # options for method dhcp $hostname = undef, $leasetime = undef, $vendor = undef, $client = undef, # options for method static $address = undef, $netmask = undef, $broadcast = undef, $gateway = undef, $pointopoint = undef, $mtu = undef, $scope = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, # feature-helpers $tx_queue = undef, $routes = {}, $dns_nameservers = undef, $dns_search = undef, ) { include debnet if !defined(Package[$debnet::params::bridge_utils_pkg]) { package { $debnet::params::bridge_utils_pkg: ensure => 'installed', } } if size($ports) > 0 { $brports = join($ports, ' ') debnet::iface { $ports: method => 'manual', tx_queue => $tx_queue, } } else { $brports = 'none' } $bropts0 = {'bridge_ports' => $brports} if $hwaddress { $bropts1 = {'bridge_hw' => $hwaddress} } else { $bropts1 = {} } $bropts2 = {'bridge_stp' => $stp ? { true => 'on', default => 'off'} } if $stp { if $prio { validate_re($prio, '^\d+$') $bropts3 = { 'bridge_bridgeprio' => $prio} } else { $bropts3 = {} } if $fwdelay { validate_re($fwdelay, '^\d+$') $bropts4 = { 'bridge_fd' => $fwdelay } } else { $bropts4 = {} } if $hello { validate_re($hello, '^\d+$') $bropts5 = { 'bridge_hello' => $hello } } else { $bropts5 = {} } if $maxage { validate_re($maxage, '^\d+$') $bropts6 = { 'bridge_maxage' => $maxage } } else { $bropts6 = {} } if $maxwait { validate_re($maxwait, '^\d+$') $bropts7 = { 'bridge_maxwait' => $maxwait } } else { $bropts7 = {} } } debnet::iface { $ifname: method => $method, auto => $auto, allows => $allows, family => $family, order => $order, metric => $metric, hostname => $hostname, leasetime => $leasetime, vendor => $vendor, client => $client, address => $address, netmask => $netmask, broadcast => $broadcast, gateway => $gateway, pointopoint => $pointopoint, mtu => $mtu, scope => $scope, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => merge( $aux_ops, $bropts0, $bropts1, $bropts2, $bropts3, $bropts4, $bropts5, $bropts6, $bropts7), routes => $routes, dns_nameservers => $dns_nameservers, dns_search => $dns_search, } } \ No newline at end of file diff --git a/manifests/iface/dhcp.pp b/manifests/iface/dhcp.pp index 63cb144..06cc60a 100644 --- a/manifests/iface/dhcp.pp +++ b/manifests/iface/dhcp.pp @@ -1,155 +1,155 @@ # == Define: iface::dhcp # # Resource to define an interface configuration stanza within interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*method*] - string # Configuration method to be used. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*hostname*] - string # The hostname to be submitted with dhcp requests. # # [*leasetime*] - int # The requested leasetime of dhcp leases. # # [*vendor*] - string # The vendor id to be submitted with dhcp requests. # # [*client*] - string # The client id to be submitted with dhcp requests. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # [*tx_queue*] - int # Feature helper for setting tx queue on the interface. # # [*routes*] - hash # Feature helper for setting static routes via the interface. # # [*dns_nameserver*] - array # Feature helper to add a list of nameservers to be configures via resolvconf # while the interface is set up. # # [*dns_search*] - array # Feature helper to add a list of domain names as dns search via resolvconf # while the interface is set up. # # === Authors # # Tibor Repasi # # === Copyright # -# Copyright 2014 Tibor Repasi +# Copyright 2016 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::dhcp ( $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, $metric = undef, $hwaddress = undef, $hostname = undef, $leasetime = undef, $vendor = undef, $client = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, # feature-helpers $tx_queue = undef, $routes = {}, $dns_nameservers = undef, $dns_search = undef, ) { include debnet validate_string($ifname) validate_bool($auto) validate_array($allows) validate_re($family, '^inet$' ) debnet::iface { $ifname : method => 'dhcp', auto => $auto, hostname => $hostname, metric => $metric, leasetime => $leasetime, vendor => $vendor, client => $client, hwaddress => $hwaddress, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => $aux_ops, tx_queue => $tx_queue, routes => $routes, dns_nameservers => $dns_nameservers, dns_search => $dns_search, } } diff --git a/manifests/iface/loopback.pp b/manifests/iface/loopback.pp index 96d2aed..6d7e807 100644 --- a/manifests/iface/loopback.pp +++ b/manifests/iface/loopback.pp @@ -1,86 +1,86 @@ # == Define: iface::loopback # # Resource to define an loopback interface stanza within interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Must conventionally always be 'lo'. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # === Authors # # Tibor Repasi # # === Copyright # -# Copyright 2015 Tibor Repasi +# Copyright 2016 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::loopback ( $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, ) { include debnet validate_re($ifname, '^lo$') validate_bool($auto) validate_array($allows) validate_re($family, '^inet$' ) debnet::iface { $ifname: method => 'loopback', auto => $auto, allows => $allows, family => $family, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => $aux_ops, } } diff --git a/manifests/iface/static.pp b/manifests/iface/static.pp index c275e1c..3a91f73 100644 --- a/manifests/iface/static.pp +++ b/manifests/iface/static.pp @@ -1,173 +1,173 @@ # == Define: iface::static # # Resource to define simple interface with static configuration stanza within # interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*address*] - string # IP address formatted as dotted-quad for IPv4. # # [*netmask*] - string # Netmask as dotted-quad or CIDR prefix length. # # [*broadcast*] - string # Broadcast address as dotted-quad or + or -. # # [*gateway*] - string # Default route to be brought up with this interface. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*pointopoint*] - stirng # Address of the ppp endpoint as dotted-quad. # # [*mtu*] - int # Size of the maximum transportable unit over this interface. # # [*scope*] - string # Scope of address validity. Values allowed are global, link or host. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # [*tx_queue*] - int # Feature helper for setting tx queue on the interface. # # [*routes*] - hash # Feature helper for setting static routes via the interface. # # [*dns_nameserver*] - array # Feature helper to add a list of nameservers to be configures via resolvconf # while the interface is set up. # # [*dns_search*] - array # Feature helper to add a list of domain names as dns search via resolvconf # while the interface is set up. # # === Authors # # Tibor Repasi # # === Copyright # -# Copyright 2015 Tibor Repasi +# Copyright 2016 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::static ( $address, $netmask, $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, $broadcast = undef, $metric = undef, $gateway = undef, $pointopoint = undef, $hwaddress = undef, $mtu = undef, $scope = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, # feature-helpers $tx_queue = undef, $routes = {}, $dns_nameservers = undef, $dns_search = undef, ) { include debnet validate_string($ifname) validate_bool($auto) validate_array($allows) validate_re($family, '^inet$' ) debnet::iface { $ifname: method => 'static', auto => $auto, allows => $allows, family => $family, order => $order, address => $address, netmask => $netmask, broadcast => $broadcast, metric => $metric, gateway => $gateway, pointopoint => $pointopoint, hwaddress => $hwaddress, mtu => $mtu, scope => $scope, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => $aux_ops, tx_queue => $tx_queue, routes => $routes, dns_nameservers => $dns_nameservers, dns_search => $dns_search, } } diff --git a/manifests/init.pp b/manifests/init.pp index 27d69f2..e4c358b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,57 +1,57 @@ # == Class: debnet # # Initial class of module. # # === Parameters # # none # # === Variables # # none # # === Examples # # include debnet # # === Authors # # Tibor Repasi # # === Copyright # -# Copyright 2015 Tibor Repasi +# Copyright 2016 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # class debnet { include debnet::params package { $debnet::params::iproute_pkg: ensure => 'installed', } concat { $debnet::params::interfaces_file: owner => 'root', group => 'root', mode => '0644', ensure_newline => true, order => 'numeric', } concat::fragment { $debnet::params::interfaces_file: target => '/etc/network/interfaces', content => template('debnet/header.erb'), order => 10, } } diff --git a/manifests/params.pp b/manifests/params.pp index a8247a4..7c97a73 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,40 +1,40 @@ # == Class: params # # Parameter settings. # # === Parameters # # none # # === Variables # # none # # === Authors # # Tibor Repasi # # === Copyright # -# Copyright 2015 Tibor Repasi +# Copyright 2016 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # class debnet::params { $interfaces_file = '/etc/network/interfaces' $iproute_pkg = 'iproute' $wvdial_pkg = 'wvdial' $dhclient_pkg = 'isc-dhcp-client' $bridge_utils_pkg = 'bridge-utils' $ifenslave_pkg = 'ifenslave-2.6' } \ No newline at end of file diff --git a/manifests/support/wvdial.pp b/manifests/support/wvdial.pp index 7109efd..9899654 100644 --- a/manifests/support/wvdial.pp +++ b/manifests/support/wvdial.pp @@ -1,77 +1,77 @@ # == Define: support/wvdial # # Resource to define wvdial() configuration # # == Examples # # See the examples folder for usage examples of the wvdial function # # == Parameters # # [*device*] - string # Specify which device to use for this config. # Each channel will require a different device, e.g. voice on ACM0, # data on ACM1, etc # # [*baud*] - string # # [*username*] - string # [*password*] - string # # [*init*] - array # will produce: # Init1 = ATZ # Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 # Init3 = AT+CFUN=1 # Init4 = AT+CGDCONT=1,"IP","INTERNETSTATIC", "1.2.3.4" # # [*autodns*] - (on|off) # Whether to add nameserver information to /etc/resolv.conf # # === Authors # # David Raison # # === Copyright # -# Copyright 2015 David Raison +# Copyright 2016 David Raison # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::support::wvdial( $device, $baud, $init = [], $username = undef, $password = undef, $autodns = 'off', ) { validate_string($device) validate_string($baud) validate_array($init) validate_re($autodns, '^on$|^off$') if $username { validate_string($username) } if $password { validate_string($password) } file { '/etc/wvdial.conf': ensure => file, content => template('debnet/wvdial.conf.erb'), } } diff --git a/metadata.json b/metadata.json index 1b2d48c..d8d2d53 100644 --- a/metadata.json +++ b/metadata.json @@ -1,23 +1,23 @@ { "name": "trepasi-debnet", - "version": "1.5.1", + "version": "1.5.2", "author": "T. Repasi", "summary": "Puppet module to manage /etc/network/interface file on Debian based Linux systems.", "tags": ["network","interfaces","ifup","ifdown","bridge","bonding"], "license": "Apache-2.0", "project_page": "https://github.com/rtib/tib-debnet.git", "source": "https://github.com/rtib/tib-debnet.git", "issues_url":"https://github.com/rtib/tib-debnet/issues", "operatingsystem_support": [ {"operatingsystem": "Debian", "operatingsystemrelease": ["6","7","8"] }, {"operatingsystem": "Ubuntu", "operatingsystemrelease": ["12.04","14.04"] } ], "dependencies": [ {"name":"puppetlabs/concat","version_requirement":">= 1.2.0 < 3.0.0"}, {"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 < 5.0.0"} ], "requirements": [ {"name": "pe", "version_requirement": "3.x" }, {"name": "puppet", "version_requirement": ">=2.7.0 <5.0.0" } ] }