--- - name: "Include distribution vars" ansible.builtin.include_vars: "proxmox.yml" - name: "Ensure install dependencies are installed on live environment" ansible.builtin.apt: state: "present" update_cache: true pkg: - "debootstrap" - "arch-install-scripts" - "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: "Download Proxmox repo signing key" ansible.builtin.get_url: url: "https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg" dest: "{{ mnt_root_path }}/etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg" mode: "0644" - name: "Configure apt in chroot" ansible.builtin.copy: dest: "{{ item.dest }}" mode: "0640" content: "{{ item.content }}" loop: - dest: "{{ mnt_root_path }}/etc/apt/sources.list" content: "{{ bootstrap_apt_sources }}" - dest: "{{ mnt_root_path }}/etc/apt/sources.list.d/pve-no-subscription.list" content: "{{ bootstrap_proxmox_apt_sources }}" - 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: "Mount EFI partition inside chroot for grub-install" # noqa: command-instead-of-module intentional because of chroot ansible.builtin.command: cmd: "mount --bind {{ mnt_boot_path }} {{ mnt_root_path }}/boot/efi" changed_when: true tags: ["molecule-notest"] - name: "Install grub to EFI partition" ansible.builtin.command: argv: - "arch-chroot" - "{{ mnt_root_path }}" - "grub-install" - "--target=x86_64-efi" - "--efi-directory=/boot/efi" - "--bootloader-id=proxmox" - "--removable" changed_when: true # NOTE: requires real EFI partition — not available in Docker # NOTE: --no-nvram used because NVRAM is not writable inside chroot tags: ["molecule-notest"] - name: "Generate grub configuration" ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} update-grub" changed_when: true # NOTE: requires kernel to be installed — not available in Docker test tags: ["molecule-notest"] - name: "Unmount EFI partition from chroot" # noqa: command-instead-of-module intentional because of chroot ansible.builtin.command: cmd: "umount {{ mnt_root_path }}/boot/efi" changed_when: true tags: ["molecule-notest"]