diff --git a/manifests/allow.pp b/manifests/allow.pp index 555e707..e645e4c 100644 --- a/manifests/allow.pp +++ b/manifests/allow.pp @@ -1,7 +1,11 @@ -define interfaces::allow ( $subsystem ) { +define interfaces::allow ( $subsystem, $order='UNSET' ) { + $order_real = $order ? { + 'UNSET' => 02, + default => $order, + } concat::fragment{"interfaces::allow-${subsystem}_${name}": target => '/etc/network/interfaces', content => "allow-${subsystem} ${name}\n\n", + order => $order_real, } } - diff --git a/manifests/auto.pp b/manifests/auto.pp index 5ed7eda..f2b1d21 100644 --- a/manifests/auto.pp +++ b/manifests/auto.pp @@ -1,6 +1,14 @@ -define interfaces::auto ( ) { +define interfaces::auto ( $order='UNSET' ) { + $order_real = $order ? { + 'UNSET' => $name ? { + 'lo' => 06, + default => 07, + }, + default => $order + } concat::fragment{"interfaces::auto_${name}": target => '/etc/network/interfaces', content => "auto ${name}\n\n", + order => $order_real, } } diff --git a/manifests/iface.pp b/manifests/iface.pp index 6fc40ab..62857bc 100644 --- a/manifests/iface.pp +++ b/manifests/iface.pp @@ -1,4 +1,4 @@ -define interfaces::iface ( $family, $method, $options=[], $auto=0, $allow_hotplug=0, $ifname='UNSET' ) { +define interfaces::iface ( $family, $method, $options=[], $auto=0, $allow_hotplug=0, $ifname='UNSET', $order='UNSET' ) { case $family { inet: { if ! ($method in [loopback, static, manual, dhcp, bootp, ppp, wvdial]) { @@ -33,8 +33,17 @@ interfaces::allow { $ifname_real: subsystem => 'hotplug' } } + $order_real = $order ? { + 'UNSET' => $ifname_real ? { + 'lo' => 04, + default => 05, + }, + default => $order, + } + concat::fragment{"interfaces::iface_${name}": target => '/etc/network/interfaces', content => inline_template("iface <%= @ifname_real %> <%= @family %> <%= @method %>\n\t<%= @options.join('\n\t') %>\n\n"), + order => $order_real, } } diff --git a/manifests/mapping.pp b/manifests/mapping.pp index 7087e4c..0b95642 100644 --- a/manifests/mapping.pp +++ b/manifests/mapping.pp @@ -1,6 +1,11 @@ -define interfaces::mapping ( $script, $maps ) { +define interfaces::mapping ( $script, $maps, $order='UNSET' ) { + $order_real = $order ? { + 'UNSET' => 03, + default => $order, + } concat::fragment{"interfaces::mapping_${name}": target => '/etc/network/interfaces', content => inline_template("mapping <%= @name %>\n\tscript <%= @script %>\n\t<%= @maps.join('\n\t') %>\n\n"), + order => $order_real, } }