diff --git a/README.md b/README.md index 72c0b76..0fb59c9 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,7 @@ Normal interface - VLAN - static (minimal): network::if::static { 'eth0.330': ensure => 'up', + vlan => true, ipaddress => '10.2.3.248', netmask => '255.255.255.0', } diff --git a/manifests/if/static.pp b/manifests/if/static.pp index 09f1ca4..5d03965 100644 --- a/manifests/if/static.pp +++ b/manifests/if/static.pp @@ -53,6 +53,7 @@ $ipaddress, $netmask, $gateway = undef, + $vlan = false, $ipv6address = undef, $ipv6init = false, $ipv6gateway = undef, @@ -83,6 +84,7 @@ $macaddy = $macaddress } # Validate booleans + validate_bool($vlan) validate_bool($userctl) validate_bool($ipv6init) validate_bool($ipv6autoconf) @@ -96,6 +98,7 @@ ipv6address => $ipv6address, netmask => $netmask, gateway => $gateway, + vlan => $vlan, ipv6gateway => $ipv6gateway, ipv6autoconf => $ipv6autoconf, macaddress => $macaddy, diff --git a/manifests/init.pp b/manifests/init.pp index ff3cbbc..0088fdc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -100,6 +100,7 @@ $netmask, $macaddress, $gateway = undef, + $vlan = false, $ipv6address = undef, $ipv6gateway = undef, $ipv6init = false, @@ -123,6 +124,7 @@ $check_link_down = false ) { # Validate our booleans + validate_bool($vlan) validate_bool($userctl) validate_bool($isalias) validate_bool($peerdns) @@ -165,6 +167,10 @@ 'down' => 'no', default => undef, } + $vlanyes = $vlan ? { + true => 'yes', + default => undef, + } $iftemplate = template('network/ifcfg-eth.erb') } diff --git a/templates/ifcfg-eth.erb b/templates/ifcfg-eth.erb index 3f17d2d..1590a48 100644 --- a/templates/ifcfg-eth.erb +++ b/templates/ifcfg-eth.erb @@ -8,6 +8,8 @@ BOOTPROTO=<%= @bootproto %> ONBOOT=<%= @onboot %> HOTPLUG=<%= @onboot %> TYPE=Ethernet +<% if @vlanyes %>VLAN=<%= @vlanyes %> +<% end -%> <% if @ipaddress and @ipaddress != '' %>IPADDR=<%= @ipaddress %> <% end -%> <% if @netmask and @netmask != '' %>NETMASK=<%= @netmask %>