copr: backend: detect swap is enabled before disabling it
I am not opening a question whether disabling swap is a good idea, I'm just want to make the execution of the playbook idempotent.
This commit is contained in:
parent
7ddd7caf1c
commit
1c3b58a671
1 changed files with 8 additions and 3 deletions
|
@ -247,7 +247,12 @@
|
|||
fstype: swap
|
||||
state: absent
|
||||
|
||||
- name: detect if swap is enabled
|
||||
shell: test -n "$(swapon -s)"
|
||||
register: swap_enabled
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: disable swap so that OOM killer can do his job
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
- swapoff -a
|
||||
command: swapoff -a
|
||||
when: swap_enabled.rc != 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue