--- - name: "Include Raspberry vars" ansible.builtin.include_vars: "raspberry.yml" - name: "Ensure install dependencies are installed on live environment" ansible.builtin.apt: state: "present" update_cache: true pkg: - "debootstrap" - "arch-install-scripts" - "gnupg" - "bash" - name: "Run debootstrap" ansible.builtin.command: cmd: "debootstrap {{ bootstrap_opts }} {{ bootstrap_distro.name }} {{ mnt_root_path }} {{ bootstrap_distro.mirror_url }}" 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 apt in chroot" ansible.builtin.copy: dest: "{{ item.dest }}" mode: "0640" content: "{{ item.content }}" loop: - dest: "{{ mnt_root_path }}/etc/apt/preferences.d/ignored-package" content: "{{ bootstrap_apt_ignored_preferences }}" - dest: "{{ mnt_root_path }}/etc/apt/sources.list" content: "{{ bootstrap_apt_sources }}" - name: "Download signing key" ansible.builtin.get_url: url: "https://archive.raspberrypi.org/debian/raspberrypi.gpg.key" dest: "/opt/raspberrypi.gpg.key" force: true mode: "0644" - name: "Dearmor signing key" ansible.builtin.command: cmd: "gpg -o {{ mnt_root_path }}/usr/share/keyrings/raspberrypi.gpg --dearmor /opt/raspberrypi.gpg.key" changed_when: true - name: "Configure system in chroot" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} {{ item }}" changed_when: true loop: - "apt-get update" - "apt-get install -y {{ bootstrap_distro.packages | join(' ') }}" - name: "Update rpi kernel and firmware" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} rpi-update" environment: SKIP_BACKUP: "1" WANT_64BIT: "1" WANT_PI5: "1" SKIP_WARNING: "1" SKIP_CHECK_PARTITION: "1" changed_when: true tags: ["molecule-notest"] - name: "Configure bootloader" ansible.builtin.template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "0644" loop: - src: "raspberry/raspberry.config.j2" dest: "{{ mnt_boot_path }}/config.txt" - src: "raspberry/raspberry.cmdline.j2" dest: "{{ mnt_boot_path }}/cmdline.txt" - name: "Configure boot order" ansible.builtin.shell: | set -eo pipefail rpi-eeprom-config --apply <(rpi-eeprom-config | sed 's/^BOOT_ORDER=.*/BOOT_ORDER={{ bootstrap_boot_order }}/') args: executable: "bash" changed_when: true tags: ["molecule-notest"]