modules: misc: Support VIP's in network config

This commit is contained in:
James Shubin
2025-01-02 15:42:40 -05:00
parent 5858c8b501
commit 802823dcb0

View File

@@ -100,6 +100,7 @@ class network_manager_static($st) {
$prefix = net.cidr_to_prefix($cidr) $prefix = net.cidr_to_prefix($cidr)
$router = $st->router || "" $router = $st->router || ""
$dns = $st->dns || "8.8.8.8" $dns = $st->dns || "8.8.8.8"
$vips []str = $st->vips || [] # []cidr
$tmpl = $tmpl =
" "
@@ -118,6 +119,12 @@ address1=${ip}/${prefix},{{ .router }}
{{ else -}} {{ else -}}
address1=${ip}/${prefix} address1=${ip}/${prefix}
{{ end -}} {{ end -}}
{{ if .vips -}}
{{ range $index, $ip := .vips }}
{{ $ix := len (printf \"xx%*s\" $index \"\") -}}
address{{ $ix }}={{ $ip }}
{{ end -}}
{{ end -}}
dns=${dns}; dns=${dns};
dns-search= dns-search=
may-fail=false may-fail=false
@@ -133,6 +140,7 @@ mac-address={{ .mac }}
uuid => $uuid, uuid => $uuid,
mac => $mac, mac => $mac,
router => $router, router => $router,
vips => $vips,
} }
file "/etc/NetworkManager/system-connections/${dev}.nmconnection" { file "/etc/NetworkManager/system-connections/${dev}.nmconnection" {