Files
cloud-basis/tasks/mount.yml
T
lhahnandClaude Opus 5.5 a6f015fd68 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>
2026-10-14 20:44:47 +02:00

29 lines
980 B
YAML
Executable File

- 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') }}"
dev: "{{ mnt.dev }}"
loop: "{{ mount_points }}"
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:
path: "{{ mnt.path }}"
src: "{{ mnt.dev }}"
state: "{{ mnt.state | default('mounted') }}"
fstype: "{{ mnt.fstype | default('ext4') }}"
opts: "{{ mnt.opts | default('defaults') }}"
loop: "{{ mount_points }}"
loop_control:
loop_var: mnt
label: "{{ mnt.dev }}: {{ mnt.path }}"