feat: properly remove swap

This commit is contained in:
Simon Cornet 2025-07-21 15:49:44 +02:00
commit 891ca42a79

View file

@ -67,7 +67,7 @@
when: "swap_file_check.stat.exists and not __swap" when: "swap_file_check.stat.exists and not __swap"
# configure fstab # configure fstab
- name: "swap - configure fstab" - name: "swap - configure fstab - part 1"
ansible.posix.mount: ansible.posix.mount:
name: "swapfile" name: "swapfile"
src: "{{ swap_file_location | default('/swapfile') }}" src: "{{ swap_file_location | default('/swapfile') }}"
@ -77,3 +77,11 @@
dump: "0" dump: "0"
state: "absent" state: "absent"
when: "not __swap" when: "not __swap"
# configure fstab
- name: "swap - configure fstab - part 2"
ansible.builtin.lineinfile:
path: "/etc/fstab"
regexp: "swap"
state: "absent"
when: "not __swap"