refactor ♻️: Refactor memory variables and calculations
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.
This commit is contained in:
2026-02-15 12:45:26 +01:00
parent 8af5d2f806
commit c3327cd681
3 changed files with 5 additions and 4 deletions

View File

@@ -6,8 +6,8 @@
- name: ram | Calculate log2ram size
ansible.builtin.set_fact:
_total_ram_mb: "{{ ansible_memtotal_mb }}"
_calculated_size_mb: "{{ (ansible_memtotal_mb * log2ram_ram_percent / 100) | int }}"
_total_ram_mb: "{{ log2ram_host_memtotal_mb }}"
_calculated_size_mb: "{{ (log2ram_host_memtotal_mb * log2ram_ram_percent / 100) | int }}"
log2ram_size_mb: >-
{{
[log2ram_min_size_mb,

View File

@@ -15,7 +15,7 @@
ansible.builtin.command: swapoff -a
when:
- proxmox_disable_swap
- ansible_memtotal_mb >= proxmox_min_ram_mb_for_no_swap
- log2ram_host_memtotal_mb >= proxmox_min_ram_mb_for_no_swap
- active_swaps.stdout | bool
changed_when: active_swaps.stdout | bool
@@ -26,4 +26,4 @@
replace: '\1# \2'
when:
- proxmox_disable_swap
- ansible_memtotal_mb >= proxmox_min_ram_mb_for_no_swap
- log2ram_host_memtotal_mb >= proxmox_min_ram_mb_for_no_swap