refactor(vars): add system/hypervisor dict inputs
This commit is contained in:
@@ -3,13 +3,27 @@
|
||||
vars:
|
||||
bootstrap_debian_release: >-
|
||||
{{
|
||||
'bullseye' if bootstrap_os_key == 'debian11'
|
||||
else 'bookworm' if bootstrap_os_key == 'debian12'
|
||||
'buster' if (os_version | string) == '10'
|
||||
else 'bullseye' if (os_version | string) == '11'
|
||||
else 'bookworm' if (os_version | string) == '12'
|
||||
else 'trixie' if (os_version | string) == '13'
|
||||
else 'sid' if (os_version | string) == 'unstable'
|
||||
else 'trixie'
|
||||
}}
|
||||
bootstrap_debian_base_list: "{{ lookup('vars', bootstrap_var_key).base | default([]) }}"
|
||||
bootstrap_debian_extra_list: "{{ lookup('vars', bootstrap_var_key).extra | default([]) }}"
|
||||
bootstrap_debian_base: "{{ bootstrap_debian_base_list | reject('equalto', '') | join(',') }}"
|
||||
bootstrap_debian_version_packages: >-
|
||||
{{
|
||||
lookup('vars', bootstrap_var_key)
|
||||
| reject('equalto', '')
|
||||
| list
|
||||
}}
|
||||
bootstrap_debian_base_list: >-
|
||||
{{
|
||||
bootstrap_debian_base
|
||||
| reject('equalto', '')
|
||||
| list
|
||||
}}
|
||||
bootstrap_debian_extra_list: "{{ bootstrap_debian_version_packages | difference(bootstrap_debian_base_list) }}"
|
||||
bootstrap_debian_base: "{{ bootstrap_debian_base_list | join(',') }}"
|
||||
bootstrap_debian_extra: >-
|
||||
{{
|
||||
(
|
||||
@@ -18,12 +32,20 @@
|
||||
| reject('equalto', '')
|
||||
| join(' ')
|
||||
}}
|
||||
ansible.builtin.command: "{{ item }}"
|
||||
loop:
|
||||
- >-
|
||||
block:
|
||||
- name: Install Debian base system
|
||||
ansible.builtin.command: >-
|
||||
debootstrap --include={{ bootstrap_debian_base }}
|
||||
{{ bootstrap_debian_release }} /mnt http://deb.debian.org/debian/
|
||||
- "{{ chroot_command }} /mnt apt install -y {{ bootstrap_debian_extra }}"
|
||||
- "{{ chroot_command }} /mnt apt remove -y libcups2 libavahi-common3 libavahi-common-data"
|
||||
register: bootstrap_result
|
||||
changed_when: bootstrap_result.rc == 0
|
||||
register: bootstrap_debian_base_result
|
||||
changed_when: bootstrap_debian_base_result.rc == 0
|
||||
|
||||
- name: Install extra packages
|
||||
ansible.builtin.command: "{{ chroot_command }} apt install -y {{ bootstrap_debian_extra }}"
|
||||
register: bootstrap_debian_extra_result
|
||||
changed_when: bootstrap_debian_extra_result.rc == 0
|
||||
|
||||
- name: Remove unnecessary packages
|
||||
ansible.builtin.command: "{{ chroot_command }} apt remove -y libcups2 libavahi-common3 libavahi-common-data"
|
||||
register: bootstrap_debian_remove_result
|
||||
changed_when: bootstrap_debian_remove_result.rc == 0
|
||||
|
||||
Reference in New Issue
Block a user