--- - name: "Ensure proxmox-kernel-helper is installed" become: true ansible.builtin.apt: name: "proxmox-kernel-helper" state: "present" - name: "Check if proxmox-boot-tool already initialized" ansible.builtin.stat: path: "/etc/kernel/proxmox-boot-uuids" register: proxmox_boot_tool_uuids - name: "Initialize proxmox-boot-tool" become: true when: not proxmox_boot_tool_uuids.stat.exists tags: # Since there is no EFI partition on container environment, ignoring this block - "molecule-notest" block: - name: "Get EFI partition device" ansible.builtin.command: cmd: "blkid -l -t PARTLABEL=boot -o device" register: proxmox_boot_tool_efi_device changed_when: false - name: "Unmount EFI partition" ansible.builtin.command: cmd: "umount /boot/efi" register: proxmox_boot_tool_umount changed_when: proxmox_boot_tool_umount.rc == 0 failed_when: proxmox_boot_tool_umount.rc not in [0, 32] - name: "Initialize proxmox-boot-tool on EFI partition" ansible.builtin.command: cmd: "proxmox-boot-tool init {{ proxmox_boot_tool_efi_device.stdout | trim }} grub" changed_when: true - name: "Sync kernels to EFI partition" ansible.builtin.command: cmd: "proxmox-boot-tool refresh" changed_when: true - name: "Remount EFI partition" ansible.posix.mount: path: "/boot/efi" src: "{{ proxmox_boot_tool_efi_device.stdout | trim }}" fstype: "vfat" state: "ephemeral"