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
|
fstype: swap
|
||||||
state: absent
|
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
|
- name: disable swap so that OOM killer can do his job
|
||||||
command: "{{ item }}"
|
command: swapoff -a
|
||||||
with_items:
|
when: swap_enabled.rc != 0
|
||||||
- swapoff -a
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue