fix(partitioning): correct LVM swap sizing and harden UUID fallbacks
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
when:
|
||||
- system_cfg.features.swap.enabled | bool
|
||||
- partitioning_vm_memory is not defined or (partitioning_vm_memory | float) <= 0
|
||||
- system_cfg is not defined or (system_cfg.memory | default(0) | float) <= 0
|
||||
- (system_cfg.memory | default(0) | float) <= 0
|
||||
block:
|
||||
- name: Read system memory
|
||||
ansible.builtin.command: awk '/MemTotal/ {print int($2/1024)}' /proc/meminfo
|
||||
@@ -272,10 +272,11 @@
|
||||
partitioning_lvm_swap_target_gb: >-
|
||||
{{
|
||||
(
|
||||
[
|
||||
(partitioning_memory_mb | float / 1024),
|
||||
4
|
||||
] | max | float
|
||||
((partitioning_memory_mb | float / 1024) >= 16.0)
|
||||
| ternary(
|
||||
(partitioning_memory_mb | float / 2048),
|
||||
[(partitioning_memory_mb | float / 1024), 4] | max | float
|
||||
)
|
||||
)
|
||||
if system_cfg.features.swap.enabled | bool
|
||||
else 0
|
||||
@@ -310,6 +311,7 @@
|
||||
(
|
||||
(partitioning_disk_size_gb | float)
|
||||
- (partitioning_reserved_gb | float)
|
||||
# CIS partitioning overhead (GB): /home, /var, /var/log, /var/log/audit
|
||||
- (system_cfg.features.cis.enabled | ternary(7.5, 0))
|
||||
- partitioning_lvm_extent_reserve_gb
|
||||
- 4
|
||||
@@ -514,31 +516,31 @@
|
||||
{{
|
||||
partitioning_uuid_swap_result.stdout_lines | default([])
|
||||
if system_cfg.features.swap.enabled | bool
|
||||
else ''
|
||||
else []
|
||||
}}
|
||||
partitioning_uuid_home: >-
|
||||
{{
|
||||
partitioning_uuid_home_result.stdout_lines | default([])
|
||||
if system_cfg.features.cis.enabled
|
||||
else ''
|
||||
else []
|
||||
}}
|
||||
partitioning_uuid_var: >-
|
||||
{{
|
||||
partitioning_uuid_var_result.stdout_lines | default([])
|
||||
if system_cfg.features.cis.enabled
|
||||
else ''
|
||||
else []
|
||||
}}
|
||||
partitioning_uuid_var_log: >-
|
||||
{{
|
||||
partitioning_uuid_var_log_result.stdout_lines | default([])
|
||||
if system_cfg.features.cis.enabled
|
||||
else ''
|
||||
else []
|
||||
}}
|
||||
partitioning_uuid_var_log_audit: >-
|
||||
{{
|
||||
partitioning_uuid_var_log_audit_result.stdout_lines | default([])
|
||||
if system_cfg.features.cis.enabled
|
||||
else ''
|
||||
else []
|
||||
}}
|
||||
|
||||
- name: Mount filesystems
|
||||
@@ -562,6 +564,7 @@
|
||||
opts: "{{ item.opts }}"
|
||||
state: mounted
|
||||
loop:
|
||||
# ssd: no-op on kernels 5.15+ (btrfs auto-detects); kept for older kernel compat
|
||||
- path: ""
|
||||
uuid: "{{ partitioning_uuid_root[0] | default(omit) }}"
|
||||
opts: >-
|
||||
|
||||
Reference in New Issue
Block a user