diff --git a/overlays/fstab/internal/fstab_test.go b/overlays/fstab/internal/fstab_test.go index 247d1504..7403e197 100644 --- a/overlays/fstab/internal/fstab_test.go +++ b/overlays/fstab/internal/fstab_test.go @@ -63,6 +63,6 @@ proc /proc proc defaults 0 0 # all with noauto as mounts happens with systemd units /dev/disk/by-partlabel/scratch /scratch btrfs noauto,defaults 0 0 /dev/disk/by-partlabel/swap swap swap noauto,defaults 0 0 -# nfs mounts provided in warewulf.conf +# Resource: NFSHOME 192.168.0.1:/home /home nfs defaults 0 0 ` diff --git a/overlays/fstab/internal/nodes.conf b/overlays/fstab/internal/nodes.conf index c3b365ac..04f8a5ce 100644 --- a/overlays/fstab/internal/nodes.conf +++ b/overlays/fstab/internal/nodes.conf @@ -1,5 +1,7 @@ nodes: node1: + resource_list: + - NFSHOME disks: /dev/vda: wipe_table: true @@ -17,3 +19,10 @@ nodes: /dev/disk/by-partlabel/swap: format: swap path: swap +resource: + NFSHOME: + mountpoint: /home + moptions: defaults + eoptions: rw,rootsquash + epath: /home + server: controller diff --git a/overlays/fstab/rootfs/etc/fstab.ww b/overlays/fstab/rootfs/etc/fstab.ww index 63feb6a3..5b969cc0 100644 --- a/overlays/fstab/rootfs/etc/fstab.ww +++ b/overlays/fstab/rootfs/etc/fstab.ww @@ -12,12 +12,11 @@ proc /proc proc defaults 0 0 {{- if $fs.MountOptions }} noauto{{range $index,$opt := $fs.MountOptions }},{{ $opt }}{{ end }} 0 0 {{- else }} noauto,defaults 0 0 {{- end }}{{ end }}{{ end }} -{{- $IP:=.Ipaddr }} -{{- if .Nfs.Enabled }} -# nfs mounts provided in warewulf.conf -{{- range .Nfs.ExportsExtended }} -{{- if .Mount }} -{{ $IP }}:{{ .Path }} {{ .Path }} nfs {{ .MountOptions }} 0 0 -{{- end }} -{{- end }} +{{- $Resource := .Resource }}{{ $server := .Ipaddr}}{{/* export the needed values */}} +{{- range $i,$ResName := .ResourceList }} +{{- if eq (substr 0 3 $ResName) "NFS" }}{{ $nfs := (index $Resource $ResName)}} +# Resource: {{ $ResName }} +{{- if not (eq $nfs.server "controller") }}{{ $server = $nfs.server }}{{ end }} +{{ $server }}:{{ $nfs.epath}} {{ $nfs.mountpoint }} nfs {{ $nfs.moptions }} 0 0 {{- end }} +{{- end }} \ No newline at end of file