refactor ♻️: Refactor memory calculation logic #35

Merged
Jose merged 1 commits from dev into main 2026-02-15 17:40:30 +01:00
2 changed files with 2 additions and 3 deletions

View File

@@ -37,7 +37,6 @@ log2ram_ram_percent: 10
log2ram_min_size_mb: 128
log2ram_max_size_mb: 1024
log2ram_host_memtotal_mb: "{{ host_memtotal_mb | default(4086) }}"
Review

[Score: 3] Removing hardcoded memory limit for log2ram_host_memtotal_mb could potentially lead to excessive RAM usage if not properly managed. It is recommended to set an appropriate default value or use a dynamic calculation based on available system resources.

[Score: 3] Removing hardcoded memory limit for log2ram_host_memtotal_mb could potentially lead to excessive RAM usage if not properly managed. It is recommended to set an appropriate default value or use a dynamic calculation based on available system resources.
# Journald RAM usage limit
journald_runtime_max_use: "100M"

View File

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