Merge pull request #398 from jcsiadal/staticdhcp

Fix host overlay support for static DHCP
This commit is contained in:
Gregory M. Kurtzer
2022-04-27 22:13:41 -07:00
committed by GitHub

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}}