-
Notifications
You must be signed in to change notification settings - Fork 0
/
glm-network-config.template.dos
69 lines (66 loc) · 1.91 KB
/
glm-network-config.template.dos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# (C) Copyright 2024 Hewlett Packard Enterprise Development LP
{{- if .Connections}}
version: 1
config:
{{- $vlan_parent := ""}}
{{- range .Connections}}
# multiple interfaces or networks so we need a bond/team NIC
{{- range .Interfaces}}
- type: physical
name: {{.Name}}
mac_address: {{.HWAddr}}
mtu: 1450
{{- end}}
- type: bond
name: {{.Name}}
mac_address: {{(index .Interfaces 0).HWAddr}}
bond_interfaces:
{{- range .Interfaces}}
- {{.Name}}
{{- end}}
params:
bond-mode: active-backup
bond-lacp-rate: false
{{- $vlan_parent = .Name}}
{{- if gt .UntaggedNet.VID 0 }}
{{- $net_zero := .UntaggedNet }}
{{- $range_zero := index $net_zero.Ranges 0 }}
subnets:
- type: static
address: {{$range_zero.Base}}/{{$range_zero.CIDR}}
gateway: {{$range_zero.Gateway}}
{{- if $range_zero.DNS}}
dns_nameservers:
{{- range $range_zero.DNS}}
{{- if .}} {{/* Don't print an empty element */}}
- {{.}}
{{- end}}
{{- end}}
{{- end}}
{{- end }}
{{- if gt (len .Networks) 0 }}
# multiple networks with vlans
{{- range .Networks}}
- type: vlan
name: "{{$vlan_parent}}.{{.VID}}"
vlan_link: {{$vlan_parent}}
vlan_id: {{.VID}}
{{- $range_zero := index .Ranges 0}}
subnets:
- type: static
address: {{$range_zero.Base}}/{{$range_zero.CIDR}}
{{- if $range_zero.Gateway}}
gateway: {{$range_zero.Gateway}}
{{- end}}
{{- if $range_zero.DNS}}
dns_nameservers:
{{- range $range_zero.DNS}}
{{- if .}} {{/* Don't print an empty element */}}
- {{.}}
{{- end}}
{{- end}}
{{- end}}
{{- end}}
{{- end}}
{{- end}} {{/* range .Connections */}}
{{- end}} {{/* end if .Connections */}}