For hosts with ip addresses, the hosts file entry should be: <ip> <node_name>-<net-name> <node_name>-<network_device> For the default network interface, the node name is included as well: <ip> <node_name> <node_name>-<net-name> <node_name>-<network_device>
16 lines
872 B
Cheetah
16 lines
872 B
Cheetah
{{$.PrevHostFile}}# Do not edit after this line - these host entries are maintained by 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 */}}
|
|
{{- 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 */}}
|
|
{{- end}} {{/* end if ip */}}
|
|
{{- end}} {{/* end for each network device */}}
|
|
{{end}} {{/* end for each node */}}
|
|
|