Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network::if::static: Add VLAN capability #87

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down
3 changes: 3 additions & 0 deletions manifests/if/static.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
$ipaddress,
$netmask,
$gateway = undef,
$vlan = false,
$ipv6address = undef,
$ipv6init = false,
$ipv6gateway = undef,
Expand Down Expand Up @@ -83,6 +84,7 @@
$macaddy = $macaddress
}
# Validate booleans
validate_bool($vlan)
validate_bool($userctl)
validate_bool($ipv6init)
validate_bool($ipv6autoconf)
Expand All @@ -96,6 +98,7 @@
ipv6address => $ipv6address,
netmask => $netmask,
gateway => $gateway,
vlan => $vlan,
ipv6gateway => $ipv6gateway,
ipv6autoconf => $ipv6autoconf,
macaddress => $macaddy,
Expand Down
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
$netmask,
$macaddress,
$gateway = undef,
$vlan = false,
$ipv6address = undef,
$ipv6gateway = undef,
$ipv6init = false,
Expand All @@ -123,6 +124,7 @@
$check_link_down = false
) {
# Validate our booleans
validate_bool($vlan)
validate_bool($userctl)
validate_bool($isalias)
validate_bool($peerdns)
Expand Down Expand Up @@ -165,6 +167,10 @@
'down' => 'no',
default => undef,
}
$vlanyes = $vlan ? {
true => 'yes',
default => undef,
}
$iftemplate = template('network/ifcfg-eth.erb')
}

Expand Down
2 changes: 2 additions & 0 deletions templates/ifcfg-eth.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down