Refactor of server, logging, building of images, template updates
* Combine provision response handling, add hwaddr and interface to dhcp * Simplify stage cases, add backward compatible uri parse * Move control of image compression to client * Fix kernel search path for ubuntu, buffer template generation * Implement cpio and gz as functions, add log named functions * Generalize fs image creation routine * Combine daemonLogf to generalized wwlog * Fix template newline insertion, update dhcp and hosts tmpl * Update IPXE template to handle non-compressed files * Update DHCP template to set network interfaces and server IP assignment * Update DHCP/hosts templates to choose a host-name self-consistently
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
{{if .Dhcp.Enabled -}}
|
||||
# This file is autogenerated by warewulf
|
||||
# This file is autogenerated by warewulf
|
||||
# Host: {{.BuildHost}}
|
||||
# Time: {{.BuildTime}}
|
||||
# Source: {{.BuildSource}}
|
||||
|
||||
{{if ne .Dhcp.Interface "" -}}
|
||||
INTERFACESv4="{{$.Dhcp.Interface}}";
|
||||
{{- end}}
|
||||
|
||||
allow booting;
|
||||
allow bootp;
|
||||
ddns-update-style interim;
|
||||
@@ -14,6 +19,16 @@ option space ipxe;
|
||||
option ipxe.no-pxedhcp code 176 = unsigned integer 8;
|
||||
option ipxe.no-pxedhcp 1;
|
||||
|
||||
# https://ipxe.org/cfg/syslogs
|
||||
{{if ne .Dhcp.Syslog "" -}}
|
||||
option log-servers {{$.Dhcp.Syslog}};
|
||||
{{end -}}
|
||||
{{if ne .Dhcp.Syslogs "" -}}
|
||||
option ipxe-encap-opts code 175 = encapsulate ipxe;
|
||||
option ipxe.syslogs code 85 = string;
|
||||
option ipxe.syslogs "{{$.Dhcp.Syslogs}}";
|
||||
{{end -}}
|
||||
|
||||
option architecture-type code 93 = unsigned integer 16;
|
||||
|
||||
if exists user-class and option user-class = "iPXE" {
|
||||
@@ -35,20 +50,35 @@ if exists user-class and option user-class = "iPXE" {
|
||||
}
|
||||
}
|
||||
|
||||
host {{$.Id}} {
|
||||
{{- if ne .Dhcp.Hwaddr ""}}
|
||||
hardware ethernet {{$.Dhcp.Hwaddr}};
|
||||
{{- end}}
|
||||
fixed-address {{$.Ipaddr}};
|
||||
option host-name "{{$.Id}}";
|
||||
}
|
||||
|
||||
{{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}};
|
||||
{{- 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.Default.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 -}}
|
||||
{{end -}}
|
||||
|
||||
{{else -}}
|
||||
subnet {{$.Network}} netmask {{$.Netmask}} {
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
{{ IncludeBlock "/etc/hosts" "# Do not edit after this line" }}
|
||||
# Do not edit after this line
|
||||
# This block is autogenerated by warewulf
|
||||
# This block is autogenerated by warewulf
|
||||
# Host: {{.BuildHost}}
|
||||
# Time: {{.BuildTime}}
|
||||
# Source: {{.BuildSource}}
|
||||
|
||||
# Warewulf Server
|
||||
{{$.Ipaddr}} {{$.BuildHost}}
|
||||
{{range $node := $.AllNodes}} {{/* for each node */}}
|
||||
# Entry for {{$node.Id.Get}}
|
||||
{{- range $devname, $netdev := $node.NetDevs}} {{/* for each network device on the node */}}
|
||||
{{- if $netdev.Ipaddr.Defined}} {{/* if we have an ip address on this network device */}}
|
||||
{{- if $netdev.Default.GetB}} {{/* emit the node name as hostname if this is the default */}}
|
||||
{{$netdev.Ipaddr.Get}} {{$node.Id.Get}} {{$node.Id.Get}}-{{$devname}} {{$node.Id.Get}}-{{$netdev.Device.Get}}
|
||||
{{- else}}
|
||||
{{$netdev.Ipaddr.Get}} {{$node.Id.Get}}-{{$devname}} {{$node.Id.Get}}-{{$netdev.Device.Get}}
|
||||
{{- end}} {{/* end if default */}}
|
||||
{{- /* emit the node name as hostname if this is the default */}}
|
||||
{{$netdev.Ipaddr.Get}}
|
||||
{{- if $netdev.Default.GetB}} {{$node.Id.Get}}
|
||||
{{else}} {{$node.Id.Get}}-{{if $netdev.Device.Defined}}{{$netdev.Device.Get}}{{else}}{{$devname}}{{end}}
|
||||
{{- end}}
|
||||
{{- end}} {{/* end if ip */}}
|
||||
{{- end}} {{/* end for each network device */}}
|
||||
{{end}} {{/* end for each node */}}
|
||||
{{- end}} {{/* end for each node */}}
|
||||
|
||||
Reference in New Issue
Block a user