fix: fix condition to create swap file
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/notify Pipeline was successful

This commit is contained in:
Robert Kaussow 2024-04-17 14:45:29 +02:00
parent 3d80f545d0
commit 2423e9ecda
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0

View File

@ -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 }}"