refactor(bootstrap): standardize patterns, extract common logic, remove dead code
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
- name: Global defaults loaded
|
||||
ansible.builtin.debug:
|
||||
msg: Global defaults loaded.
|
||||
changed_when: false
|
||||
|
||||
- name: Normalize hypervisor inputs
|
||||
ansible.builtin.include_tasks: hypervisor.yml
|
||||
@@ -17,7 +16,6 @@
|
||||
ansible.builtin.set_fact:
|
||||
is_rhel: "{{ os | lower in ['almalinux', 'fedora', 'rhel', 'rocky'] }}"
|
||||
is_debian: "{{ os | lower in ['debian', 'ubuntu', 'ubuntu-lts'] }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Normalize OS version for keying
|
||||
when:
|
||||
@@ -25,23 +23,6 @@
|
||||
- (os_version | string | length) > 0
|
||||
ansible.builtin.set_fact:
|
||||
os_version_major: "{{ (os_version | string).split('.')[0] }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Resolve final OS key with version
|
||||
when:
|
||||
- os_version is defined
|
||||
- (os_version | string | length) > 0
|
||||
ansible.builtin.set_fact:
|
||||
os_resolved: >-
|
||||
{{
|
||||
'debian' + os_version | string if os == 'debian'
|
||||
else 'fedora' + os_version | string if os == 'fedora'
|
||||
else 'rocky' + os_version_major if os == 'rocky'
|
||||
else 'almalinux' + os_version_major if os == 'almalinux'
|
||||
else 'rhel' + os_version_major if os == 'rhel'
|
||||
else os
|
||||
}}
|
||||
changed_when: false
|
||||
|
||||
- name: Set chroot command wrapper
|
||||
ansible.builtin.set_fact:
|
||||
@@ -51,7 +32,6 @@
|
||||
if (system_cfg.features.chroot.tool | default('arch-chroot')) == 'systemd-nspawn'
|
||||
else (system_cfg.features.chroot.tool | default('arch-chroot')) ~ ' /mnt'
|
||||
}}
|
||||
changed_when: false
|
||||
|
||||
- name: Set Python interpreter for RHEL-based installers
|
||||
when:
|
||||
@@ -59,7 +39,6 @@
|
||||
- is_rhel | bool
|
||||
ansible.builtin.set_fact:
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
changed_when: false
|
||||
|
||||
- name: Set SSH access
|
||||
when:
|
||||
@@ -70,10 +49,8 @@
|
||||
ansible_password: "{{ system_cfg.users[0].password }}"
|
||||
ansible_become_password: "{{ system_cfg.users[0].password }}"
|
||||
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||
changed_when: false
|
||||
|
||||
- name: Set connection for VMware
|
||||
when: hypervisor_type == "vmware"
|
||||
ansible.builtin.set_fact:
|
||||
ansible_connection: vmware_tools
|
||||
changed_when: false
|
||||
|
||||
Reference in New Issue
Block a user