fix: fix condition to create swap file
This commit is contained in:
parent
3d80f545d0
commit
2423e9ecda
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- when: swap_size | int > (ansible_swaptotal_mb | int) + 1 or not (swap_enabled | bool)
|
- when: not (swap_enabled | bool) or swap_size | int > (ansible_swaptotal_mb | int) + 1
|
||||||
block:
|
block:
|
||||||
- name: Disable active swap
|
- name: Disable active swap
|
||||||
ansible.builtin.shell: "test -f {{ swap_path }} && swapoff {{ swap_path }} || true"
|
ansible.builtin.shell: "test -f {{ swap_path }} && swapoff {{ swap_path }} || true"
|
||||||
@ -9,7 +9,9 @@
|
|||||||
path: "{{ swap_path }}"
|
path: "{{ swap_path }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- when: swap_size | int > (ansible_swaptotal_mb | int) + 1
|
- when:
|
||||||
|
- swap_enabled | bool
|
||||||
|
- swap_size | int > (ansible_swaptotal_mb | int) + 1
|
||||||
block:
|
block:
|
||||||
- name: Create swap file
|
- name: Create swap file
|
||||||
ansible.builtin.command: "fallocate -l {{ swap_size }}M {{ swap_path }}"
|
ansible.builtin.command: "fallocate -l {{ swap_size }}M {{ swap_path }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user