generalize role to a generale mount role

This commit is contained in:
nd 2020-11-21 00:22:02 +01:00
parent 1e93481389
commit 0ab1f2d078
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
3 changed files with 30 additions and 24 deletions

View file

@ -1,27 +1,8 @@
- name: install nfs client tools
package:
name: nfs-client
when: mounts.values()|selectattr("type", "equalto", "nfs")|list|length > 0
- name: create mount points if they don't exist
with_dict: "{{ nfs }}"
file:
path: "{{ item.value.mountpoint }}"
state: directory
- name: mount nfs shares
with_dict: "{{ nfs }}"
mount:
path: "{{ item.value.mountpoint }}"
src: "{{ item.value.source }}"
opts: "{{ item.value.options }}"
fstype: nfs
state: mounted
- name: write nfs shares to fstab
with_dict: "{{ nfs }}"
mount:
path: "{{ item.value.mountpoint }}"
src: "{{ item.value.source }}"
opts: "{{ item.value.options }}"
fstype: nfs
state: present
- name: handle single mount
include_tasks: mount.yml
loop: "{{ mounts|dict2items }}"