Skip to content

Commit 92a3c6c

Browse files
author
Jan Kapellen
committed
replayed pr razorsedge#87 by Millnert to enable vlan by device
1 parent 106d300 commit 92a3c6c

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,26 +247,21 @@ Static interface routes (host route):
247247

248248
Normal interface - VLAN - no IP:
249249

250-
class { 'network::global':
251-
vlan => 'yes',
252-
}
253-
254250
network::if { 'eth0.330':
255251
ensure => 'up',
256-
}
252+
vlan => 'yes',
253+
}
257254

258255
Normal interface - VLAN - static IPv4:
259256

260-
class { 'network::global':
261-
vlan => 'yes',
262-
}
263-
264257
network::if::static { 'eth0.330':
265258
ensure => 'up',
266259
ipaddress => '10.2.3.248',
267260
netmask => '255.255.255.0',
261+
vlan => 'yes',
268262
}
269263

264+
270265
Promiscuous interface:
271266
To set a static or dynamic interface to promiscuous mode (RedHat only), add:
272267
promisc => true

manifests/if/static.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
# $defroute - optional
3030
# $restart - optional - defaults to true
3131
# $arpcheck - optional - defaults to true
32+
# $vlan - optional - defaults to false
3233
#
3334
# === Actions:
3435
#
@@ -82,6 +83,7 @@
8283
$metric = undef,
8384
$restart = true,
8485
$arpcheck = true,
86+
$vlan = false,
8587
) {
8688
# Validate our data
8789
if $ipaddress {
@@ -118,6 +120,7 @@
118120
validate_bool($manage_hwaddr)
119121
validate_bool($flush)
120122
validate_bool($arpcheck)
123+
validate_bool($vlan)
121124

122125
network_if_base { $title:
123126
ensure => $ensure,

manifests/init.pp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
# $promisc - optional - defaults to false
8080
# $restart - optional - defaults to true
8181
# $arpcheck - optional - defaults to true
82+
# $vlan - optional - defaults to false
8283
#
8384
# === Actions:
8485
#
@@ -140,6 +141,7 @@
140141
$promisc = false,
141142
$restart = true,
142143
$arpcheck = true,
144+
$vlan = false,
143145
) {
144146
# Validate our booleans
145147
validate_bool($noaliasrouting)
@@ -155,6 +157,7 @@
155157
validate_bool($promisc)
156158
validate_bool($restart)
157159
validate_bool($arpcheck)
160+
validate_bool($vlan)
158161
# Validate our regular expressions
159162
$states = [ '^up$', '^down$' ]
160163
validate_re($ensure, $states, '$ensure must be either "up" or "down".')
@@ -192,7 +195,10 @@
192195
}
193196
$iftemplate = template('network/ifcfg-eth.erb')
194197
}
195-
198+
$vlanyes = $vlan ? {
199+
true => 'yes',
200+
default => undef,
201+
}
196202
if $flush {
197203
exec { 'network-flush':
198204
user => 'root',

templates/ifcfg-eth.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,6 @@ check_link_down() {
7070
<% end -%>
7171
<% if !@arpcheck %>ARPCHECK=no
7272
<% end -%>
73+
<% if @vlanyes %>VLAN=<%= @vlanyes %>
74+
<% end -%>
7375
NM_CONTROLLED=no

0 commit comments

Comments
 (0)