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>
51 lines
1.2 KiB
Plaintext
51 lines
1.2 KiB
Plaintext
{{- range $devname, $netdev := .NetDevs }}
|
|
{{- file (print "ifcfg-" $devname ".conf") -}}
|
|
# This file is autogenerated by warewulf
|
|
{{- if eq $netdev.Type "vlan" }}
|
|
VLAN=yes
|
|
{{- else }}
|
|
TYPE={{ default "Ethernet" $netdev.Type }}
|
|
{{- end }}
|
|
{{- if $netdev.Tags.master }}
|
|
SLAVE=yes
|
|
MASTER={{ $netdev.Tags.master }}
|
|
{{- end }}
|
|
{{- if $netdev.Device }}
|
|
DEVICE={{ $netdev.Device }}
|
|
{{- end }}
|
|
NAME={{ $devname }}
|
|
{{- if $netdev.MTU }}
|
|
MTU={{ $netdev.MTU }}
|
|
{{- end }}
|
|
BOOTPROTO=static
|
|
DEVTIMEOUT=10
|
|
{{- if $netdev.Ipaddr }}
|
|
IPADDR={{ $netdev.Ipaddr }}
|
|
{{- end }}
|
|
{{- if $netdev.Netmask }}
|
|
NETMASK={{ $netdev.Netmask }}
|
|
{{- end }}
|
|
{{- if $netdev.Gateway }}
|
|
GATEWAY={{ $netdev.Gateway }}
|
|
{{- end }}
|
|
{{- if $netdev.Hwaddr }}
|
|
HWADDR={{ $netdev.Hwaddr }}
|
|
{{- end }}
|
|
ONBOOT={{ $netdev.OnBoot.BoolDefaultTrue }}
|
|
IPV6INIT=yes
|
|
IPV6_AUTOCONF=yes
|
|
IPV6_DEFROUTE=yes
|
|
IPV6_FAILURE_FATAL=no
|
|
{{- if $netdev.Ipaddr6 }}
|
|
IPV6ADDR="{{ $netdev.Ipaddr6 }}"
|
|
{{- end }}
|
|
{{- range $tk, $tv := $netdev.Tags }}
|
|
{{- if regexMatch "^DNS[0-9]*$" $tk }}
|
|
{{ $tk }}={{ $tv }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if $netdev.Tags.DNSSEARCH }}
|
|
DOMAIN="{{ join " " (without (regexSplit "[ ;]+" $netdev.Tags.DNSSEARCH -1) "") }}"
|
|
{{- end }}
|
|
{{- end }}
|