From 8f1e49e1687c40b375d84d27be3a6549d5ac704f Mon Sep 17 00:00:00 2001 From: "Santana, Divan" Date: Mon, 18 Aug 2014 15:24:20 +0200 Subject: [PATCH] Allow for the HWADDR configuration line to optionally disabled --- manifests/if/static.pp | 29 ++++++++++++++++------------- manifests/init.pp | 2 ++ templates/ifcfg-eth.erb | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/manifests/if/static.pp b/manifests/if/static.pp index a6d34d4..4c2a84c 100644 --- a/manifests/if/static.pp +++ b/manifests/if/static.pp @@ -8,6 +8,7 @@ # $ipaddress - required # $netmask - required # $gateway - optional +# $hwaddr_disable - optional # $macaddress - optional - defaults to macaddress_$title # $userctl - optional - defaults to false # $mtu - optional @@ -44,6 +45,7 @@ $ipaddress, $netmask, $gateway = '', + $hwaddr_disable = false, $macaddress = '', $userctl = false, $mtu = '', @@ -65,18 +67,19 @@ validate_bool($userctl) network_if_base { $title: - ensure => $ensure, - ipaddress => $ipaddress, - netmask => $netmask, - gateway => $gateway, - macaddress => $macaddy, - bootproto => 'none', - userctl => $userctl, - mtu => $mtu, - ethtool_opts => $ethtool_opts, - peerdns => $peerdns, - dns1 => $dns1, - dns2 => $dns2, - domain => $domain, + ensure => $ensure, + ipaddress => $ipaddress, + netmask => $netmask, + gateway => $gateway, + hwaddr_disable => $hwaddr_disable, + macaddress => $macaddy, + bootproto => 'none', + userctl => $userctl, + mtu => $mtu, + ethtool_opts => $ethtool_opts, + peerdns => $peerdns, + dns1 => $dns1, + dns2 => $dns2, + domain => $domain, } } # define network::if::static diff --git a/manifests/init.pp b/manifests/init.pp index 1ec4f85..b2cbe3e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -52,6 +52,7 @@ # $ensure - required - up|down # $ipaddress - required # $netmask - required +# $hwaddr_disable - optional # $macaddress - required # $gateway - optional # $bootproto - optional @@ -96,6 +97,7 @@ $ensure, $ipaddress, $netmask, + $hwaddr_disable = false, $macaddress, $gateway = '', $bootproto = 'none', diff --git a/templates/ifcfg-eth.erb b/templates/ifcfg-eth.erb index b9bd175..6da9c8e 100644 --- a/templates/ifcfg-eth.erb +++ b/templates/ifcfg-eth.erb @@ -3,7 +3,7 @@ ### DEVICE=<%= @interface %> BOOTPROTO=<%= @bootproto %> -<% if !@macaddress.empty? %>HWADDR=<%= @macaddress %> +<% if @hwaddr_disable != true and !@macaddress.empty? %>HWADDR=<%= @macaddress %> <% end -%> ONBOOT=<%= @onboot %> HOTPLUG=<%= @onboot %>