All checks were successful
ansible-lint / Ansible Lint (push) Successful in 12s
Gitleaks Scan / gitleaks (push) Successful in 4s
Markdown Lint / markdown-lint (push) Successful in 5s
ai-reviews / Review PR (pull_request) Successful in 4s
PR check / Gitleaks (pull_request) Successful in 5s
PR check / lint tests (pull_request) Successful in 15s
PR check / labeler (pull_request) Successful in 2s
PR check / handle_failures (pull_request) Has been skipped
PR check / handle_success (pull_request) Successful in 2s
Renamed `_total_ram_mb` to `log2ram_host_memtotal_mb` and updated the calculation accordingly. Updated variable names for memory checks in swap task.
30 lines
831 B
YAML
30 lines
831 B
YAML
---
|
|
- name: swap | Set vm.swappiness
|
|
ansible.posix.sysctl:
|
|
name: vm.swappiness
|
|
value: "{{ proxmox_swapiness }}"
|
|
state: present
|
|
reload: yes
|
|
|
|
- name: swap | Gather active swaps
|
|
ansible.builtin.command: swapon --noheadings --show=NAME
|
|
register: active_swaps
|
|
changed_when: false
|
|
|
|
- name: swap | Disable swap if host has enough RAM
|
|
ansible.builtin.command: swapoff -a
|
|
when:
|
|
- proxmox_disable_swap
|
|
- log2ram_host_memtotal_mb >= proxmox_min_ram_mb_for_no_swap
|
|
- active_swaps.stdout | bool
|
|
changed_when: active_swaps.stdout | bool
|
|
|
|
- name: swap | Comment swap entries in fstab
|
|
ansible.builtin.replace:
|
|
path: /etc/fstab
|
|
regexp: '^(\s*)(?!#)(\S+\s+\S+\s+swap\s+.*)$'
|
|
replace: '\1# \2'
|
|
when:
|
|
- proxmox_disable_swap
|
|
- log2ram_host_memtotal_mb >= proxmox_min_ram_mb_for_no_swap
|