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:
|
||||
- name: Disable active swap
|
||||
ansible.builtin.shell: "test -f {{ swap_path }} && swapoff {{ swap_path }} || true"
|
||||
@ -9,7 +9,9 @@
|
||||
path: "{{ swap_path }}"
|
||||
state: absent
|
||||
|
||||
- when: swap_size | int > (ansible_swaptotal_mb | int) + 1
|
||||
- when:
|
||||
- swap_enabled | bool
|
||||
- swap_size | int > (ansible_swaptotal_mb | int) + 1
|
||||
block:
|
||||
- name: Create swap file
|
||||
ansible.builtin.command: "fallocate -l {{ swap_size }}M {{ swap_path }}"
|
||||
|
Loading…
Reference in New Issue
Block a user