updated overlays

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2024-07-17 15:30:51 +02:00
committed by Jonathon Anderson
parent 342236b9b9
commit 9fdb9ca792
10 changed files with 45 additions and 32 deletions

View File

@@ -1,5 +1,16 @@
WW_INTERNAL: 45
WW_INTERNAL: 46
nodeprofiles:
default:
comment: This profile is automatically included for each node
runtime overlay:
- generic
system overlay:
- wwinit
kernel:
args: quiet crashkernel=no
init: /sbin/init
root: initramfs
ipxe template: default
profiles:
- default
nodes: {}

View File

@@ -81,7 +81,7 @@ func (config *NodeYaml) SetProfile(profileId string, vals ProfileConf) error {
Add a node with the given ID and return a pointer to it
*/
func (config *NodeYaml) AddProfile(profileId string) (*ProfileConf, error) {
profile := NewProfile(profileId)
profile := EmptyProfile()
wwlog.Verbose("adding new profile: %s", profileId)
if _, ok := config.nodeProfiles[profileId]; ok {
return nil, errors.New("profile already exists: " + profileId)

View File

@@ -52,9 +52,9 @@ mtu={{ $netdev.MTU }}
{{ end -}}
{{ end -}}
{{ if and ($netdev.IpCIDR) (ne $netdev.Type "bond-slave") -}}
{{ if and ($netdev.Ipaddr) (ne $netdev.Type "bond-slave") -}}
[ipv4]
address={{ $netdev.IpCIDR }}
address={{ $netdev.Ipaddr }}
{{ if $netdev.Gateway -}}
gateway={{ $netdev.Gateway }}
{{ end -}}

View File

@@ -51,7 +51,6 @@ data from other structures.
- Device: {{ $netdev.Device }}
- Hwaddr: {{ $netdev.Hwaddr }}
- Ipaddr: {{ $netdev.Ipaddr }}
- IpCIDR: {{ $netdev.IpCIDR }}
- Ipaddr6: {{ $netdev.Ipaddr6 }}
- Prefix: {{ $netdev.Prefix }}
- Netmask: {{ $netdev.Netmask }}
@@ -165,7 +164,6 @@ data from other structures.
- Hwaddr: {{ $netdev.Hwaddr.Get }}
- Ipaddr: {{ $netdev.Ipaddr.Get }}
- Ipaddr6: {{ $netdev.Ipaddr6.Get }}
- IpCIDR: {{ $netdev.IpCIDR.Get }}
- Prefix: {{ $netdev.Prefix.Get }}
- Netmask: {{ $netdev.Netmask.Get }}
- Gateway: {{ $netdev.Gateway.Get }}

View File

@@ -57,16 +57,16 @@ subnet {{$.Network}} netmask {{$.Netmask}} {
{{- if eq .Dhcp.Template "static" }}
{{- range $nodes := $.AllNodes}}
{{- range $netname, $netdevs := $nodes.NetDevs}}
host {{$nodes.Id.Get}}-{{$netname}}
host {{$nodes.Id}}-{{$netname}}
{
{{- if $netdevs.Hwaddr.Defined}}
hardware ethernet {{$netdevs.Hwaddr.Get}};
{{- if $netdevs.Hwaddr}}
hardware ethernet {{$netdevs.Hwaddr}};
{{- end }}
{{- if $netdevs.Ipaddr.Defined}}
fixed-address {{$netdevs.Ipaddr.Get}};
{{- if $netdevs.Ipaddr}}
fixed-address {{$netdevs.Ipaddr}};
{{- end }}
{{- if $netdevs.Primary.GetB}}
option host-name "{{$nodes.Id.Get}}";
{{- if $netdevs.Primary}}
option host-name "{{$nodes.Id}}";
{{- end }}
}
{{end -}}{{/* range NetDevs */}}

View File

@@ -35,9 +35,9 @@ dhcp-range={{$.Dhcp.RangeStart}},{{$.Dhcp.RangeEnd}},{{$.Netmask}},6h
{{/* Add all the known hosts */}}
{{- range $node := $.AllNodes}} {{/* for each node */}}
{{- 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.Hwaddr.Defined }}
dhcp-host={{$netdev.Hwaddr.Get}},set:warewulf,{{$node.Id.Get}},{{$netdev.Ipaddr.Get}},infinite
{{- if $netdev.Ipaddr}} {{/* if we have an ip address on this network device */}}
{{- if $netdev.Hwaddr }}
dhcp-host={{$netdev.Hwaddr}},set:warewulf,{{$node.Id}},{{$netdev.Ipaddr}},infinite
{{- end}}{{/* end if Hwaddr */}}
{{- end}}{{/* end if ip */}}
{{- end}}{{/* end for each network device */}}

View File

@@ -5,12 +5,12 @@
# Warewulf Server
{{$.Ipaddr}} {{$.BuildHost}} warewulf
{{- 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 */}}
{{- range $node := $.AllNodes}} {{/* for each node */}}
# Entry for {{$node.Id}}
{{- range $devname, $netdev := $node.NetDevs}} {{/* for each network device on the node */}}
{{- if $netdev.Ipaddr}} {{/* if we have an ip address on this network device */}}
{{- /* emit the node name as hostname if this is the primary */}}
{{$netdev.Ipaddr.Get}} {{if $netdev.Primary.GetB}}{{$node.Id.Get}}{{end}} {{$node.Id.Get}}-{{$devname}} {{if $netdev.Device.Defined}}{{$node.Id.Get}}-{{$netdev.Device.Get}}{{end}}
{{$netdev.Ipaddr}} {{if $netdev.Primary}}{{$node.Id}}{{end}} {{$node.Id}}-{{$devname}} {{if $netdev.Device}}{{$node.Id}}-{{$netdev.Device}}{{end}}
{{- end }}{{/* if ip */}}
{{- end }}{{/* for each network device */}}
{{- end }}{{/* for each node */}}

View File

@@ -6,7 +6,11 @@ Kernelargs: {{.Kernel.Args}}
Network:
{{- range $devname, $netdev := .NetDevs}}
{{$devname}}: {{$netdev.Device}}
{{$devname}}: {{$netdev.IpCIDR}}
{{if $netdev.Ipaddr6 }} {{$devname}}: {{$netdev.Ipaddr6}}{{ end -}}
{{if $netdev.Hwaddr }} {{$devname}}: {{$netdev.Hwaddr}}{{ end -}}
{{end}}
{{$devname}}: \4{{ print "{" }}{{$netdev.Device}}{{ print "}" }}
{{- if $netdev.Ipaddr6 }}
{{$devname}}: \6{{ print "{" }}{{$netdev.Device}}{{ print "}" }}
{{- end }}
{{- if $netdev.Hwaddr }}
{{$devname}}: {{$netdev.Hwaddr}}
{{- end }}
{{- end}}

View File

@@ -24,7 +24,7 @@ This file is autogenerated by warewulf
</ipv4>
<ipv4:static>
<address>
<local>{{ (index $NetDevs $devname).IpCIDR }}</local>
<local>{{$netdev.Ipaddr}}/{{$netdev.Ipmask}}</local>
</address>
{{ if $netdev.Gateway.Get -}}
<route>

View File

@@ -110,7 +110,7 @@ The following template will create a file called
</ipv4>
<ipv4:static>
<address>
<local>{{$netdev.IpCIDR}}</local>
<local>{{$netdev.Ipaddr}}/{{$netdev.Ipmask}}</local>
</address>
{{ if $netdev.Gateway -}}
<route>
@@ -177,13 +177,13 @@ string is "# Do not edit after this line"
{{$.Ipaddr}} warewulf {{$.BuildHost}}
{{- range $node := $.AllNodes}} {{/* for each node */}}
# Entry for {{$node.Id.Get}}
# Entry for {{$node.Id}}
{{- 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.Ipaddr}} {{/* if we have an ip address on this network device */}}
{{- /* emit the node name as hostname if this is the primary */}}
{{$netdev.Ipaddr.Get}} {{$node.Id.Get}}-{{$devname}}
{{- if $netdev.Device.Defined}} {{$node.Id.Get}}-{{$netdev.Device.Get}}{{end}}
{{- if $netdev.Primary.GetB}} {{$node.Id.Get}}{{end}}
{{$netdev.Ipaddr}} {{$node.Id}}-{{$devname}}
{{- if $netdev.Device}} {{$node.Id()}}-{{$netdev.Device}}{{end}}
{{- if $netdev.Primary}} {{$node.Id()}}{{end}}
{{- end}} {{/* end if ip */}}
{{- end}} {{/* end for each network device */}}
{{- end}} {{/* end for each node */}}