fix: unmount swap before changing it
ci/woodpecker/push/docs Pipeline was successful Details
ci/woodpecker/push/notify Pipeline was successful Details
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/push/test Pipeline was successful Details

This commit is contained in:
Robert Kaussow 2024-04-17 14:49:32 +02:00
parent 2423e9ecda
commit 8644006b8e
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
1 changed files with 9 additions and 2 deletions

View File

@ -1,9 +1,16 @@
---
- when: not (swap_enabled | bool) or swap_size | int > (ansible_swaptotal_mb | int) + 1
block:
- name: Disable active swap
- name: Disable swap
ansible.builtin.shell: "test -f {{ swap_path }} && swapoff {{ swap_path }} || true"
- name: Unmount swap file
ansible.posix.mount:
src: "{{ swap_path }}"
path: none
fstype: swap
state: absent
- name: Remove swap file
ansible.builtin.file:
path: "{{ swap_path }}"
@ -35,6 +42,6 @@
fstype: swap
state: present
- name: Enable swap file
- name: Enable swap
ansible.builtin.command: "swapon -a"
changed_when: False