feat: by mount enable flag instead dedicated variable

This commit is contained in:
vincent 2023-12-23 20:39:29 +01:00
parent bf15d49fe8
commit 4db724ba69
3 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,4 @@
systemd_mounts: {}
systemd_mounts_enabled: []
@ -8,4 +7,4 @@ systemd_mounts_enabled: []
# type:
# path:
# username:
# password:
# password:

View File

@ -9,7 +9,7 @@
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.mount"
enabled: yes
with_dict: "{{ systemd_mounts }}"
when: item.value.automount == false
when: item.value.automount == false and item.value.enabled==true
become: yes
- name: Enable systemd automount
@ -18,7 +18,7 @@
enabled: yes
with_dict: "{{ systemd_mounts }}"
when: item.value.automount == true
when: item.value.automount == true and item.value.enabled==true
become: yes
@ -27,7 +27,7 @@
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.mount"
state: started
with_dict: "{{ systemd_mounts }}"
when: item.value.automount == false
when: item.value.automount == false and item.value.enabled==true
become: yes
- name: Start systemd automount
@ -35,5 +35,5 @@
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.automount"
state: started
with_dict: "{{ systemd_mounts }}"
when: item.value.automount == true
when: item.value.automount == true and item.value.enabled==true
become: yes

View File

@ -65,7 +65,6 @@
- Enable systemd mount
- Start systemd mount
become: yes
when: item.key in systemd_mounts_enabled
- name: SYSTEMD MOUNT | Setup systemd Service for automount
template:
@ -77,7 +76,7 @@
- Enable systemd automount
- Start systemd automount
become: yes
when: item.value.automount is defined and item.value.automount == true and item.key in systemd_mounts_enabled
when: item.value.automount is defined and item.value.automount == true