It does not work like I want it to - presumably since it counts for tasks _within_ the play while it is the connection for the play itself which requires root?
95 lines
2.4 KiB
YAML
95 lines
2.4 KiB
YAML
- name: Void install base system
|
|
hosts: guest
|
|
become: true
|
|
vars:
|
|
ansible_chroot_exe: arch-chroot
|
|
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
|
|
|
|
- name: Void configure system
|
|
hosts: guest
|
|
become: true
|
|
vars:
|
|
host_name: voider
|
|
timezone: Europe/Madrid
|
|
locales_enabled:
|
|
- en_US.UTF-8 UTF-8
|
|
tasks:
|
|
- name: Set hostname
|
|
ansible.builtin.template:
|
|
src: hostname.tpl
|
|
dest: /etc/hostname
|
|
|
|
- name: Set timezone
|
|
ansible.builtin.file:
|
|
path: /etc/localtime
|
|
src: /usr/share/zoneinfo/{{ timezone }}
|
|
state: link
|
|
|
|
- name: Set glibc locales
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/default/libc-locales
|
|
regexp: "^{{ item }}"
|
|
line: "{{ item }}"
|
|
state: present
|
|
create: true
|
|
loop: "{{ locales_enabled }}"
|