shell command with no change but register should always run

This commit is contained in:
Jérémy Lecour 2017-02-15 16:22:33 +01:00 committed by Jérémy Lecour
parent b85a9178e3
commit 8f871821dd
2 changed files with 10 additions and 4 deletions

View File

@ -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 }}"

View File

@ -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