Files
warewulf/overlays/NetworkManager/rootfs/etc/NetworkManager/system-connections/ww4-managed.ww
Jonathon Anderson c209dadc1f Update network interface bonding configuration and documentation
- Closes: #1482
- Closes: #1280

This also corrects poor handling of whitespace around the "file" function
throughout the templates, given experiences with the network templates while
implementing the bond behavior. Since the file function actually does produce
output (that is parsed by Warewulf itself) it should not collaps prefix
whitespace.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-21 09:42:27 -07:00

79 lines
1.7 KiB
Plaintext

{{- range $devname, $netdev := .NetDevs }}
{{ file (print "warewulf-" $devname ".conf") }}
# This file is autogenerated by warewulf
[connection]
id={{ $devname }}
interface-name={{ $netdev.Device }}
type={{ default "ethernet" (lower $netdev.Type) }}
{{- if $netdev.Tags.master }}
master={{ $netdev.Tags.master }}
slave-type=bond
{{- end }}
{{- if $netdev.OnBoot }}
autoconnect=true
{{- end }}
{{- if eq (lower $netdev.Type) "bond" }}
[bond]
downdelay={{ default 0 $netdev.Tags.downdelay }}
miimon={{ default 100 $netdev.Tags.miimon }}
mode={{ default "balance-rr" $netdev.Tags.mode }}
xmit_hash_policy={{ default "layer2+3" $netdev.Tags.xmit_hash_policy }}
updelay={{ default 0 $netdev.Tags.updelay }}
{{- end }}
{{- if eq (lower $netdev.Type) "infiniband" }}
[infiniband]
transport-mode=datagram
{{- if $netdev.MTU }}
mtu={{ $netdev.MTU }}
{{- end }}
{{- else }}
[ethernet]
{{- if $netdev.Hwaddr }}
mac-address={{ $netdev.Hwaddr }}
{{- end }}
{{- if $netdev.MTU }}
mtu={{ $netdev.MTU }}
{{- end }}
{{- end }}
{{- if not $netdev.Tags.master }}
[ipv4]
method=manual
{{- if $netdev.IpCIDR }}
address={{ $netdev.IpCIDR }}
{{- end }}
{{- if $netdev.Gateway }}
gateway={{ $netdev.Gateway }}
{{- end }}
{{- $dns := "" }}
{{- range $tk, $tv := $netdev.Tags }}
{{- if eq (substr 0 3 $tk) "DNS" }}
{{- $dns = print $dns $tv ";" }}
{{- else if eq (substr 0 5 $tk) "route" }}
{{$tk}}={{$tv}}
{{- end }}
{{- end }}
{{- if $dns }}
dns={{$dns}}
{{- end }}
{{- end }}
{{- if eq $netdev.Type "vlan" }}
[vlan]
interface-name={{ $netdev.Device }}
parent={{ $netdev.Tags.parent_device }}
id={{ $netdev.Tags.vlan_id }}
{{- end }}
[ipv6]
addr-gen-mode=stable-privacy
method=ignore
never-default=true
{{- if $netdev.Ipaddr6 }}
ipaddr="{{ $netdev.Ipaddr6 }}"
{{- end }}
{{- end }}