From 8f871821dd75025b32b8f42f2581ee2bab97ba35 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 15 Feb 2017 16:22:33 +0100 Subject: [PATCH] shell command with no change but register should always run --- tasks/remount-off.yml | 11 +++++++---- tasks/remount-on.yml | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tasks/remount-off.yml b/tasks/remount-off.yml index 2d6d5c5..2b3656e 100644 --- a/tasks/remount-off.yml +++ b/tasks/remount-off.yml @@ -16,6 +16,9 @@ register: mount changed_when: False failed_when: False + # Use this with Ansible 2.1+ + #when: not ansible_check_mod + always_run: yes with_items: "{{ partitions }}" - name: Remount /usr if it is a partition and it is not mounted in ro @@ -23,12 +26,12 @@ when: item.0 == "/usr" and item.1.rc == 0 and not item.1.stdout_lines.0|search("ro") failed_when: False with_together: - - "{{ partitions }}" - - "{{ mount.results }}" + - "{{ partitions }}" + - "{{ mount.results }}" - name: Remount /tmp if it is a partition and it is not mounted in noexec command: "mount -o remount {{ item.0 }}" when: item.0 == "/tmp" and item.1.rc == 0 and not item.1.stdout_lines.0|search("noexec") with_together: - - "{{ partitions }}" - - "{{ mount.results }}" + - "{{ partitions }}" + - "{{ mount.results }}" diff --git a/tasks/remount-on.yml b/tasks/remount-on.yml index 4e26595..ea7689e 100644 --- a/tasks/remount-on.yml +++ b/tasks/remount-on.yml @@ -17,6 +17,9 @@ register: mount changed_when: False failed_when: False + # Use this with Ansible 2.1+ + #when: not ansible_check_mod + always_run: yes with_items: "{{ partitions }}" - name: Remount /usr if it is a partition and it is not mounted in rw