Use state-based routing instead of sentinel strings, so whitespace-trimming
syntax (e.g. `{{- file "name" -}}`) correctly creates all named files and
symlinks.
Fixes: #2118
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
Co-authored-by: Christian Goll <cgoll@suse.com>
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
27 lines
945 B
Plaintext
27 lines
945 B
Plaintext
{{- range $devname, $netdev := .ThisNode.NetDevs }}
|
|
{{- file $devname -}}
|
|
# This file is autogenerated by warewulf
|
|
{{- if $netdev.OnBoot.BoolDefaultTrue }}
|
|
auto {{ $netdev.Device }}
|
|
{{- end }}
|
|
allow-hotplug {{ $netdev.Device }}
|
|
{{- if $netdev.Ipaddr }}
|
|
iface {{ $netdev.Device }} inet static
|
|
address {{ $netdev.Ipaddr }}
|
|
netmask {{ $netdev.Netmask }}
|
|
{{ if $netdev.Gateway }}gateway {{ $netdev.Gateway }}{{ end }}
|
|
{{ if $netdev.MTU }}mtu {{ $netdev.MTU }}{{ end }}
|
|
{{- range $tk, $tv := $netdev.Tags }}
|
|
{{- if eq (substr 0 5 $tk) "route" }}
|
|
up ip route add {{ index (splitList "," $tv) 0 }} via {{ index (splitList "," $tv) 1 }} dev {{ $netdev.Device }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if $netdev.Ipaddr6 }}
|
|
iface {{ $netdev.Device }} inet6 static
|
|
address {{ $netdev.IpCIDR6 }}
|
|
{{ if $netdev.Gateway6 }}gateway {{ $netdev.Gateway6 }}{{ end }}
|
|
{{ if $netdev.MTU }}mtu {{ $netdev.MTU }}{{ end }}
|
|
{{- end }}
|
|
{{ end -}}
|