Split bootstrap by OS
This commit is contained in:
27
roles/bootstrap/tasks/ubuntu.yml
Normal file
27
roles/bootstrap/tasks/ubuntu.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
- name: Bootstrap Ubuntu System
|
||||
vars:
|
||||
bootstrap_ubuntu_release: >-
|
||||
{{ 'plucky' if bootstrap_os_key == 'ubuntu' else 'noble' }}
|
||||
bootstrap_ubuntu_base_list: "{{ lookup('vars', bootstrap_var_key).base | default([]) }}"
|
||||
bootstrap_ubuntu_extra_list: "{{ lookup('vars', bootstrap_var_key).extra | default([]) }}"
|
||||
bootstrap_ubuntu_base: "{{ (bootstrap_ubuntu_base_list | difference(bootstrap_guest_agent_remove_packages)) | join(',') }}"
|
||||
bootstrap_ubuntu_extra: >-
|
||||
{{
|
||||
(
|
||||
(bootstrap_ubuntu_extra_list | difference(bootstrap_guest_agent_remove_packages))
|
||||
+ bootstrap_guest_agent_packages
|
||||
)
|
||||
| join(' ')
|
||||
}}
|
||||
ansible.builtin.command: "{{ item }}"
|
||||
loop:
|
||||
- >-
|
||||
debootstrap --include={{ bootstrap_ubuntu_base }}
|
||||
{{ bootstrap_ubuntu_release }} /mnt http://archive.ubuntu.com/ubuntu/
|
||||
- ln -sf /run/NetworkManager/resolv.conf /mnt/etc/resolv.conf
|
||||
- arch-chroot /mnt sed -i '1s|$| universe|' /etc/apt/sources.list
|
||||
- arch-chroot /mnt apt update
|
||||
- "arch-chroot /mnt apt install -y {{ bootstrap_ubuntu_extra }}"
|
||||
register: bootstrap_result
|
||||
changed_when: bootstrap_result.rc == 0
|
||||
Reference in New Issue
Block a user