Fix host overlay support for static DHCP

Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>
This commit is contained in:
jcsiadal
2022-04-18 21:13:09 +00:00
parent c29848171e
commit b67078e537

View File

@@ -1,4 +1,4 @@
{{- if .Dhcp.Enabled }}
{{if .Dhcp.Enabled -}}
# This file is autogenerated by warewulf
# Host: {{.BuildHost}}
# Time: {{.BuildTime}}
@@ -35,12 +35,29 @@ if exists user-class and option user-class = "iPXE" {
}
}
{{if eq .Dhcp.Template "static" -}}
subnet {{$.Network}} netmask {{$.Netmask}} {
next-server {{$.Ipaddr}};
}
{{range $nodes := .AllNodes}}
{{- range $netdevs := $nodes.NetDevs}}
{{- if $netdevs.Default.Get}}
host {{$nodes.Id.Get}} {
hardware ethernet {{$netdevs.Hwaddr.Get}};
fixed-address {{$netdevs.Ipaddr.Get}};
}
{{end -}}
{{end -}}
{{end -}}
{{else -}}
subnet {{$.Network}} netmask {{$.Netmask}} {
max-lease-time 120;
range {{$.Dhcp.RangeStart}} {{$.Dhcp.RangeEnd}};
next-server {{$.Ipaddr}};
}
{{- else }}
{{ abort }}
{{- end }}
{{end}}
{{- else}}
{{abort}}
{{- end}}