enable grub boot for all nodes

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-07-25 15:19:16 +02:00
committed by Jonathon Anderson
parent 03ef7447e9
commit 60dc8f6251
8 changed files with 191 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
{{if .Dhcp.Enabled -}}
{{if $.Dhcp.Enabled -}}
# This file is autogenerated by warewulf
# Host: {{.BuildHost}}
# Time: {{.BuildTime}}
@@ -15,52 +15,56 @@ option space ipxe;
option ipxe.no-pxedhcp code 176 = unsigned integer 8;
option ipxe.no-pxedhcp 1;
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option architecture-type code 93 = unsigned integer 16;
{{- if eq $.ProfileMap.default.BootMethod.Get "grub" }}
if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
next-server {{ $.Ipaddr }};
filename "warewulf/shim.efi";
} elsif substring (option vendor-class-identifier, 0, 10) = "HTTPClient" {
filename "http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/grub/shim.efi";
}
{{- else }}
if exists user-class and option user-class = "iPXE" {
filename "http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}";
} else {
{{- if .BoothMethod == "ipxe" }}
{{range $type,$name := $.Tftp.IpxeBinaries }}
if option architecture-type = {{ $type }} {
filename "/warewulf/{{ basename $name }}";
}
{{- end }}{{/* range IpxeBinaries */}}
{{ else }}
filename "warewulf/shim.efi"
}
{{- end }}{{/* BootMethod */}}
}
{{if eq .Dhcp.Template "static" -}}
subnet {{$.Network}} netmask {{$.Netmask}} {
next-server {{$.Ipaddr}};
}
{{range $nodes := .AllNodes}}
{{- range $netname, $netdevs := $nodes.NetDevs}}
host {{$nodes.Id.Get}}-{{if $netdevs.Device.Defined}}{{$netdevs.Device.Get}}{{else}}{{$netname}}{{end}} {
{{- if $netdevs.Hwaddr.Defined}}
hardware ethernet {{$netdevs.Hwaddr.Get}};
{{- end}}
{{- if $netdevs.Ipaddr.Defined}}
fixed-address {{$netdevs.Ipaddr.Get}};
{{- end}}
{{- if $netdevs.Primary.GetB}}
option host-name "{{$nodes.Id.Get}}";
{{else}}
option host-name "{{$nodes.Id.Get}}-{{if $netdevs.Device.Defined}}{{$netdevs.Device.Get}}{{else}}{{$netname}}{{end}}";
{{- end}}
}
{{end -}}
{{end -}}
{{else -}}
subnet {{$.Network}} netmask {{$.Netmask}} {
max-lease-time 120;
range {{$.Dhcp.RangeStart}} {{$.Dhcp.RangeEnd}};
next-server {{$.Ipaddr}};
next-server {{.Ipaddr}};
}
{{end}}
{{- range $nodes := $.AllNodes}}
{{- range $netname, $netdevs := $nodes.NetDevs}}
host {{$nodes.Id.Get}}-{{$netdevs.Device.Get}}
{
{{- if $netdevs.Primary.GetB}}
{{- if $netdevs.Hwaddr.Defined}}
hardware ethernet {{$netdevs.Hwaddr.Get}};
{{- end }}
{{- if $netdevs.Ipaddr.Defined}}
fixed-address {{$netdevs.Ipaddr.Get}};
{{- end }}
option host-name "{{$nodes.Id.Get}}";
{{- end }}
}
{{end -}}{{/* range NetDevs */}}
{{end -}}{{/* range AllNodes */}}
{{- else}}
{{abort}}
{{- end}}
{{- end}}{{/* dhcp enabled */}}