From 4db724ba692522bcd357ac4ad392f7d168a60d76 Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 23 Dec 2023 20:39:29 +0100 Subject: [PATCH] feat: by mount enable flag instead dedicated variable --- defaults/main.yml | 3 +-- handlers/main.yml | 8 ++++---- tasks/main.yml | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 733576a..b7f63f3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,4 @@ systemd_mounts: {} -systemd_mounts_enabled: [] @@ -8,4 +7,4 @@ systemd_mounts_enabled: [] # type: # path: # username: -# password: \ No newline at end of file +# password: diff --git a/handlers/main.yml b/handlers/main.yml index c143e03..de5426e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 6f6111b..bc9c071 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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