- Make timezone, locale, and keymap configurable via system_cfg - Consolidate rhel8/9/10.repo.j2 into single rhel.repo.j2 template - Extract bootstrap_common_conditional for shared firewall/LUKS/guest packages - Remove redundant version aliases (fedora40-43, debian10-13, rhel8-10, etc.) - Simplify bootstrap dispatch from 10 conditional blocks to single mapping - Merge bootstrap_ubuntu_lts into bootstrap_ubuntu (identical) - Remove orphaned firstrun.sh.j2 template - Remove configuration/defaults/main.yml aliases, inline into banner.yml - Remove unnecessary changed_when: false on set_fact/debug tasks - Deduplicate hostname variable computation in locales.yml - Update README with timezone/locale/keymap variable reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
2.6 KiB
YAML
69 lines
2.6 KiB
YAML
---
|
|
- name: Bootstrap Ubuntu System
|
|
vars:
|
|
bootstrap_ubuntu_release: >-
|
|
{{ 'plucky' if os == 'ubuntu' else 'noble' }}
|
|
bootstrap_ubuntu_package_config: >-
|
|
{{
|
|
lookup('vars', bootstrap_var_key)
|
|
}}
|
|
bootstrap_ubuntu_base_packages: >-
|
|
{{
|
|
bootstrap_ubuntu_package_config.base
|
|
| default([])
|
|
| reject('equalto', '')
|
|
| list
|
|
}}
|
|
bootstrap_ubuntu_extra_packages: >-
|
|
{{
|
|
bootstrap_ubuntu_package_config.extra
|
|
| default([])
|
|
| reject('equalto', '')
|
|
| list
|
|
}}
|
|
bootstrap_ubuntu_base_csv: "{{ bootstrap_ubuntu_base_packages | join(',') }}"
|
|
bootstrap_ubuntu_extra: "{{ bootstrap_ubuntu_extra_packages | join(' ') }}"
|
|
block:
|
|
- name: Validate Ubuntu package configuration
|
|
ansible.builtin.assert:
|
|
that:
|
|
- bootstrap_ubuntu_package_config is mapping
|
|
- bootstrap_ubuntu_package_config.base is defined
|
|
- bootstrap_ubuntu_package_config.base is sequence
|
|
- bootstrap_ubuntu_package_config.base is not string
|
|
- bootstrap_ubuntu_package_config.extra is defined
|
|
- bootstrap_ubuntu_package_config.extra is sequence
|
|
- bootstrap_ubuntu_package_config.extra is not string
|
|
fail_msg: "bootstrap package definition for {{ bootstrap_var_key }} must be a mapping with base/extra lists."
|
|
quiet: true
|
|
|
|
- name: Install Ubuntu base system
|
|
ansible.builtin.command: >-
|
|
debootstrap --include={{ bootstrap_ubuntu_base_csv }}
|
|
{{ bootstrap_ubuntu_release }} /mnt
|
|
http://archive.ubuntu.com/ubuntu/
|
|
register: bootstrap_ubuntu_base_result
|
|
changed_when: bootstrap_ubuntu_base_result.rc == 0
|
|
|
|
- name: Ensure chroot has resolv.conf
|
|
ansible.builtin.file:
|
|
src: /run/NetworkManager/resolv.conf
|
|
dest: /mnt/etc/resolv.conf
|
|
state: link
|
|
|
|
- name: Enable universe repository
|
|
ansible.builtin.command: "{{ chroot_command }} sed -i '1s|$| universe|' /etc/apt/sources.list"
|
|
register: bootstrap_ubuntu_repo_result
|
|
changed_when: bootstrap_ubuntu_repo_result.rc == 0
|
|
|
|
- name: Update package lists
|
|
ansible.builtin.command: "{{ chroot_command }} apt update"
|
|
register: bootstrap_ubuntu_update_result
|
|
changed_when: bootstrap_ubuntu_update_result.rc == 0
|
|
|
|
- name: Install extra packages
|
|
when: bootstrap_ubuntu_extra_packages | length > 0
|
|
ansible.builtin.command: "{{ chroot_command }} apt install -y {{ bootstrap_ubuntu_extra }}"
|
|
register: bootstrap_ubuntu_extra_result
|
|
changed_when: bootstrap_ubuntu_extra_result.rc == 0
|