2026-02-07 08:29:45 +01:00
|
|
|
---
|
2026-02-07 08:45:57 +01:00
|
|
|
- name: swap | Set vm.swappiness
|
|
|
|
|
ansible.posix.sysctl:
|
2026-02-07 08:29:45 +01:00
|
|
|
name: vm.swappiness
|
|
|
|
|
value: "{{ proxmox_swapiness }}"
|
|
|
|
|
state: present
|
|
|
|
|
reload: yes
|
|
|
|
|
|
2026-02-07 08:45:57 +01:00
|
|
|
- name: swap | Disable swap if host has enough RAM
|
|
|
|
|
ansible.builtin.command: swapoff -a
|
2026-02-07 08:29:45 +01:00
|
|
|
when:
|
|
|
|
|
- proxmox_disable_swap
|
|
|
|
|
- ansible_memtotal_mb >= proxmox_min_ram_mb_for_no_swap
|
|
|
|
|
changed_when: false
|
|
|
|
|
|
2026-02-07 08:45:57 +01:00
|
|
|
- name: swap | Remove swap from fstab
|
|
|
|
|
ansible.builtin.replace:
|
2026-02-07 08:29:45 +01:00
|
|
|
path: /etc/fstab
|
|
|
|
|
regexp: '^\S+\s+\S+\s+swap\s+.*$'
|
|
|
|
|
replace: ''
|
|
|
|
|
when:
|
|
|
|
|
- proxmox_disable_swap
|
|
|
|
|
- ansible_memtotal_mb >= proxmox_min_ram_mb_for_no_swap
|