Support network mounts in mount_points

- never run mkfs for nfs/nfs4/cifs entries (the filesystem task would try to format the share)
- install nfs-common when an nfs mount is configured

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lhahnandClaude Opus 5.5 committed 2026-10-14 20:44:47 +02:00
1 parent ca99b3c6cb
commit a6f015fd68
1 file changed
+9
+9
View File
@@ -1,3 +1,10 @@
- name: install nfs client for network mounts
apt:
update_cache: yes
state: present
pkg: nfs-common
when: mount_points | selectattr('fstype', 'defined') | selectattr('fstype', 'in', ['nfs', 'nfs4']) | list | length > 0
- name: generate filesystem on mounts if not defined
filesystem:
fstype: "{{ mnt.fstype | default('ext4') }}"
@@ -6,6 +13,8 @@
loop_control:
loop_var: mnt
label: "{{ mnt.dev }}: {{ mnt.fstype | default('ext4') }}"
# network shares already have a filesystem; never format them
when: mnt.fstype | default('ext4') not in ['nfs', 'nfs4', 'cifs']
- name: mount required points
mount: