Move partitioning LUKS defaults into role

This commit is contained in:
2026-01-02 11:23:31 +01:00
parent 98d0a4954d
commit b1eedd30dc
3 changed files with 7 additions and 22 deletions

View File

@@ -3,14 +3,7 @@
when: partitioning_luks_enabled | bool when: partitioning_luks_enabled | bool
vars: vars:
configuration_luks_passphrase_effective: >- configuration_luks_passphrase_effective: >-
{{ {{ partitioning_luks_passphrase | string }}
(
partitioning_luks_passphrase
if partitioning_luks_passphrase is defined
else (luks_passphrase if luks_passphrase is defined else '')
)
| string
}}
block: block:
- name: Set LUKS configuration facts - name: Set LUKS configuration facts
vars: vars:

View File

@@ -1,5 +1,6 @@
--- ---
partitioning_luks_enabled: "{{ luks_enabled | bool }}" partitioning_luks_enabled: "{{ luks_enabled | bool }}"
partitioning_luks_passphrase: "{{ luks_passphrase }}"
partitioning_luks_mapper_name: "{{ luks_mapper_name }}" partitioning_luks_mapper_name: "{{ luks_mapper_name }}"
partitioning_luks_type: "{{ luks_type }}" partitioning_luks_type: "{{ luks_type }}"
partitioning_luks_cipher: "{{ luks_cipher }}" partitioning_luks_cipher: "{{ luks_cipher }}"
@@ -15,8 +16,6 @@ partitioning_luks_tpm2_device: "{{ luks_tpm2_device }}"
partitioning_luks_tpm2_pcrs: "{{ luks_tpm2_pcrs }}" partitioning_luks_tpm2_pcrs: "{{ luks_tpm2_pcrs }}"
partitioning_luks_keyfile_size: "{{ luks_keyfile_size }}" partitioning_luks_keyfile_size: "{{ luks_keyfile_size }}"
partitioning_luks_options: "{{ luks_options }}" partitioning_luks_options: "{{ luks_options }}"
partitioning_vm_size: 0
partitioning_vm_memory: 0
partitioning_boot_partition_suffix: 1 partitioning_boot_partition_suffix: 1
partitioning_main_partition_suffix: 2 partitioning_main_partition_suffix: 2
partitioning_efi_size_mib: 50 partitioning_efi_size_mib: 50
@@ -113,7 +112,7 @@ partitioning_vm_size_effective: >-
{{ {{
( (
partitioning_vm_size partitioning_vm_size
if (partitioning_vm_size | float) > 0 if (partitioning_vm_size is defined and (partitioning_vm_size | float) > 0)
else (vm_size if vm_size is defined else 0) else (vm_size if vm_size is defined else 0)
) )
| float | float
@@ -122,7 +121,7 @@ partitioning_vm_memory_effective: >-
{{ {{
( (
partitioning_vm_memory partitioning_vm_memory
if (partitioning_vm_memory | float) > 0 if (partitioning_vm_memory is defined and (partitioning_vm_memory | float) > 0)
else (vm_memory if vm_memory is defined else 0) else (vm_memory if vm_memory is defined else 0)
) )
| float | float

View File

@@ -1,7 +1,7 @@
--- ---
- name: Detect system memory for swap sizing - name: Detect system memory for swap sizing
when: when:
- (partitioning_vm_memory | float) <= 0 - partitioning_vm_memory is not defined or (partitioning_vm_memory | float) <= 0
- vm_memory is not defined or (vm_memory | float) <= 0 - vm_memory is not defined or (vm_memory | float) <= 0
block: block:
- name: Read system memory - name: Read system memory
@@ -17,7 +17,7 @@
- name: Set partitioning vm_size for physical installs - name: Set partitioning vm_size for physical installs
when: when:
- install_type == "physical" - install_type == "physical"
- (partitioning_vm_size | float) <= 0 - partitioning_vm_size is not defined or (partitioning_vm_size | float) <= 0
- vm_size is not defined or (vm_size | float) <= 0 - vm_size is not defined or (vm_size | float) <= 0
- install_drive | length > 0 - install_drive | length > 0
block: block:
@@ -157,14 +157,7 @@
when: partitioning_luks_enabled | bool when: partitioning_luks_enabled | bool
vars: vars:
partitioning_luks_passphrase_effective: >- partitioning_luks_passphrase_effective: >-
{{ {{ partitioning_luks_passphrase | string }}
(
partitioning_luks_passphrase
if partitioning_luks_passphrase is defined
else (luks_passphrase if luks_passphrase is defined else '')
)
| string
}}
block: block:
- name: Validate LUKS passphrase - name: Validate LUKS passphrase
ansible.builtin.assert: ansible.builtin.assert: