system/guest.yaml
Marty Oehme 68e1cf4098
Build booster initramfs if it does not exist
Working from a chroot we need to manually look for the existing kernels
and build an initramfs from them. We can not just use the auto detection
functionality since it will detect the _HOST_ system's running kernel.

Instead we get the kernel module dir(s) and manually build a booster
initramfs for each one found.
2025-02-21 17:58:04 +01:00

67 lines
1.7 KiB
YAML

- name: Void prep
hosts: guest
become: true
vars:
ansible_chroot_exe: arch-chroot
disable_root_check: true
tasks:
# Prefer booster to dracut so make sure to never install it
- name: Ignore dracut
ansible.builtin.lineinfile:
path: /etc/xbps.d/ignore-dracut.conf
line: ignorepkg=dracut
state: present
create: true # create file if absent
- name: Update xbps and system
community.general.xbps:
name:
- xbps
state: latest
update_cache: true
upgrade: true
- name: Install Base system
community.general.xbps:
name:
- base-system
state: present
- name: Get rid of temporary container metapackage
community.general.xbps:
name:
- base-container-full
state: absent
- name: Install booster
community.general.xbps:
name: booster
state: present
notify: installed-booster
handlers:
- name: List kernel module dirs
ansible.builtin.find:
paths: "/usr/lib/modules"
file_type: directory
register: found_kernels
listen: installed-booster
- name: Find kernels
ansible.builtin.set_fact:
kernel_list: "{{ found_kernels['files'] | map(attribute='path') | map('regex_replace', '^.*/(.*)$', '\\1') | list }}"
listen: installed-booster
- name: Create booster initramfs
vars:
fname: /boot/booster-void
ansible.builtin.command:
argv:
- booster
- --verbose
- build
- --kernel-version={{ item }}
- "{{ fname }}-{{ item }}.img"
creates: "{{ fname }}-{{ item }}.img"
loop: "{{ kernel_list }}"
listen: installed-booster