--- - name: "Update live environment" ansible.builtin.command: cmd: "{{ item }}" loop: - "pacman -Syu --noconfirm" - "pacman -Sy --needed archlinux-keyring --noconfirm" changed_when: true failed_when: false - name: "Run pacstrap" ansible.builtin.command: cmd: "pacstrap -K {{ mnt_root_path }} base linux linux-firmware" changed_when: true - name: "Generate fstab" ansible.builtin.shell: cmd: "genfstab -t PARTLABEL {{ mnt_root_path }} > {{ mnt_root_path }}/etc/fstab" changed_when: true - name: "Configure pacman in chroot" ansible.builtin.copy: src: "/etc/pacman.conf" dest: "{{ mnt_root_path }}/etc/pacman.conf" remote_src: true force: false mode: "0644" - name: "Configure system in chroot" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} {{ item }}" changed_when: true loop: - "pacman-key --init" - "pacman-key --populate" - "pacman -Syyu --noconfirm" - name: "Ensure rEFInd bootloader installed" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} pacman -S --noconfirm refind" changed_when: true - name: "Install rEFInd" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} refind-install" changed_when: true - name: "Configure rEFInd boot options" ansible.builtin.copy: dest: "{{ mnt_root_path }}/boot/refind_linux.conf" mode: "0644" content: | "Boot with defaults" "root=PARTLABEL={{ partition_root.name }} rw" "Boot to terminal" "root=PARTLABEL={{ partition_root.name }} rw systemd.unit=multi-user.target" - name: "Configure rEFInd settings" ansible.builtin.copy: dest: "{{ mnt_boot_path }}/EFI/refind/refind.conf" mode: "0644" content: | timeout 5 textonly true # NOTE: this is skipped because the docker test doesn't have proper EFI/refind directory created tags: ["molecule-notest"] - name: "Configure pacman hook for rEFInd kernel updates" ansible.builtin.copy: dest: "{{ mnt_root_path }}/etc/pacman.d/100-refind.hook" mode: "0644" content: | [Trigger] Type = Package Operation = Install Operation = Upgrade Target = linux [Action] Description = Updating rEFInd after kernel update When = PostTransaction Exec = /usr/bin/refind-install - name: "Ensure ansible dependencies are installed in chroot" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} pacman -S --noconfirm python3" changed_when: true