ansible-public/tasks/remount-off.yml

36 lines
1 KiB
YAML

#
# Remount partitions /usr and /tmp with their default options.
# This must be done after execution of remount-on.yml.
#
# Usage in playbooks:
#
# - include: inc/tasks/remount-off.yml
# vars:
# partitions:
# - "/tmp"
# - "/usr"
---
- name: Get mount options for partitions
shell: "mount | grep 'on {{ item }} type'"
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
with_items: "{{ partitions }}"
- name: Remount /usr if it is a partition and it is not mounted in ro
command: "mount -o remount {{ item.0 }}"
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 }}"
- 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 }}"