refactor(bootstrap): restructure package lists to self-contained per-OS dicts with base/extra/conditional

This commit is contained in:
2026-02-21 02:39:06 +01:00
parent e5bd152fb3
commit a76f317f8f
8 changed files with 425 additions and 227 deletions

View File

@@ -1,21 +1,25 @@
---
- name: Bootstrap Void Linux
vars:
bootstrap_void_packages: >-
_config: "{{ lookup('vars', bootstrap_var_key) }}"
_base_packages: "{{ _config.base | join(' ') }}"
_extra_packages: >-
{{
lookup('vars', bootstrap_var_key) | reject('equalto', '') | join(' ')
((_config.extra | default([])) + (_config.conditional | default([])))
| reject('equalto', '')
| join(' ')
}}
block:
- name: Install Void Linux base packages
- name: Install Void Linux base
ansible.builtin.command: >
xbps-install -Sy -r /mnt -R https://repo-default.voidlinux.org/current void-repo-nonfree base-system
xbps-install -Sy -r /mnt -R https://repo-default.voidlinux.org/current {{ _base_packages }}
register: bootstrap_void_base_result
changed_when: bootstrap_void_base_result.rc == 0
- name: Install extra packages
when: bootstrap_void_packages | length > 0
when: _extra_packages | trim | length > 0
ansible.builtin.command: >
xbps-install -Su -r /mnt {{ bootstrap_void_packages }}
xbps-install -Su -r /mnt {{ _extra_packages }}
register: bootstrap_void_extra_result
changed_when: bootstrap_void_extra_result.rc == 0