Remove defaults for required vars

This commit is contained in:
2025-12-28 17:10:00 +01:00
parent fd37b4ee96
commit 98d0a4954d
19 changed files with 136 additions and 135 deletions

View File

@@ -33,39 +33,54 @@
- name: Validate variables
ansible.builtin.assert:
that:
- install_type in ["virtual", "physical"]
- hypervisor in ["libvirt", "proxmox", "vmware", "none"]
- filesystem in ["btrfs", "ext4", "xfs"]
- install_drive | length > 0
- install_type == "physical" or (vm_size | float) > 0
- install_type == "physical" or (vm_memory | float) > 0
- os in ["archlinux", "almalinux", "debian11", "debian12", "debian13", "fedora", "rhel8", "rhel9", "rhel10", "rocky", "ubuntu", "ubuntu-lts"]
- os not in ["rhel8", "rhel9", "rhel10"] or rhel_iso | length > 0
- install_type is defined and install_type in ["virtual", "physical"]
- hypervisor is defined and hypervisor in ["libvirt", "proxmox", "vmware", "none"]
- filesystem is defined and filesystem in ["btrfs", "ext4", "xfs"]
- install_drive is defined and install_drive | length > 0
- hostname is defined and hostname | length > 0
- os is defined and os in ["archlinux", "almalinux", "debian11", "debian12", "debian13", "fedora", "rhel8", "rhel9", "rhel10", "rocky", "ubuntu", "ubuntu-lts"]
- os is defined and (os not in ["rhel8", "rhel9", "rhel10"] or (rhel_iso is defined and rhel_iso | length > 0))
- install_type is defined and (install_type == "physical" or (boot_iso is defined and boot_iso | length > 0))
- install_type is defined and (install_type == "physical" or (vm_size is defined and (vm_size | float) > 0))
- install_type is defined and (install_type == "physical" or (vm_memory is defined and (vm_memory | float) > 0))
- >-
install_type == "physical"
or (
(filesystem == "btrfs" and (vm_size | int) >= 10)
or (filesystem != "btrfs" and (vm_size | int) >= 20)
)
- >-
install_type == "physical"
or (
(vm_size | float)
>= (
(vm_memory | float / 1024 >= 16.0)
| ternary(
(vm_memory | float / 2048),
[vm_memory | float / 1024, 4.0] | max
)
+ 16
install_type is defined and filesystem is defined and (
install_type == "physical"
or (
vm_size is defined
and (
(filesystem == "btrfs" and (vm_size | int) >= 10)
or (filesystem != "btrfs" and (vm_size | int) >= 20)
)
)
)
- >-
install_type is defined and (
install_type == "physical"
or (
vm_size is defined
and vm_memory is defined
and (
(vm_size | float)
>= (
(vm_memory | float / 1024 >= 16.0)
| ternary(
(vm_memory | float / 2048),
[vm_memory | float / 1024, 4.0] | max
)
+ 16
)
)
)
)
- >-
vm_ip is not defined
or vm_ip | length == 0
or (vm_nms is defined and (vm_nms | int) > 0)
fail_msg: Invalid input specified, please try again.
- name: Normalize optional flags
- name: Set OS family flags
ansible.builtin.set_fact:
cis: "{{ cis | bool }}"
custom_iso: "{{ custom_iso | bool }}"
is_rhel: "{{ os | lower in ['almalinux', 'fedora', 'rhel8', 'rhel9', 'rhel10', 'rocky'] }}"
is_debian: "{{ os | lower in ['debian11', 'debian12', 'debian13', 'ubuntu', 'ubuntu-lts'] }}"
changed_when: false
@@ -114,7 +129,7 @@
- role: configuration
- role: cis
when: cis | bool
when: cis_enabled
- role: cleanup
when: install_type in ["virtual", "physical"]
@@ -126,7 +141,7 @@
post_reboot_can_connect: >-
{{
(ansible_connection | default('ssh')) != 'ssh'
or ((vm_ip | string | length) > 0)
or (vm_ip is defined and (vm_ip | string | length) > 0)
or (
install_type == 'physical'
and (ansible_host | default('') | string | length) > 0
@@ -146,6 +161,7 @@
- name: Install post-reboot extra packages
when:
- post_reboot_can_connect | bool
- extra_packages is defined
- extra_packages | length > 0
block:
- name: Normalize extra package list