modules: misc: Support VIP's in network config
This commit is contained in:
@@ -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" {
|
||||||
|
|||||||
Reference in New Issue
Block a user