Import remount-on/off.yml from former ansible repository
This commit is contained in:
parent
ac69147876
commit
64f5e46239
36
tasks/remount-off.yml
Normal file
36
tasks/remount-off.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#
|
||||||
|
# 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 " {{ item }} "
|
||||||
|
register: mount
|
||||||
|
changed_when: False
|
||||||
|
failed_when: False
|
||||||
|
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 }}"
|
36
tasks/remount-on.yml
Normal file
36
tasks/remount-on.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#
|
||||||
|
# Remount partitions /usr and /tmp respectively with rw and exec.
|
||||||
|
# This must be done before trying to write on /usr or execute something in
|
||||||
|
# /tmp.
|
||||||
|
#
|
||||||
|
# Usage in playbooks:
|
||||||
|
#
|
||||||
|
# - include: inc/tasks/remount-on.yml
|
||||||
|
# vars:
|
||||||
|
# partitions:
|
||||||
|
# - "/tmp"
|
||||||
|
# - "/usr"
|
||||||
|
#
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Get mount options for partitions
|
||||||
|
shell: mount |grep " {{ item }} "
|
||||||
|
register: mount
|
||||||
|
changed_when: False
|
||||||
|
failed_when: False
|
||||||
|
with_items: "{{ partitions }}"
|
||||||
|
|
||||||
|
- name: Remount /usr if it is a partition and it is not mounted in rw
|
||||||
|
command: "mount -o remount,rw {{ item.0 }}"
|
||||||
|
when: item.0 == "/usr" and item.1.rc == 0 and not item.1.stdout_lines.0|search("rw")
|
||||||
|
with_together:
|
||||||
|
- "{{ partitions }}"
|
||||||
|
- "{{ mount.results }}"
|
||||||
|
|
||||||
|
- name: Remount /tmp if it is a partition and it is mounted in noexec
|
||||||
|
command: "mount -o remount,exec {{ item.0 }}"
|
||||||
|
when: item.0 == "/tmp" and item.1.rc == 0 and item.1.stdout_lines.0|search("noexec")
|
||||||
|
with_together:
|
||||||
|
- "{{ partitions }}"
|
||||||
|
- "{{ mount.results }}"
|
Loading…
Reference in a new issue