diff options
Diffstat (limited to 'roles/proxmox-kernel-helper/tasks')
| -rw-r--r-- | roles/proxmox-kernel-helper/tasks/main.yml | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/roles/proxmox-kernel-helper/tasks/main.yml b/roles/proxmox-kernel-helper/tasks/main.yml new file mode 100644 index 00000000..8f9aab1f --- /dev/null +++ b/roles/proxmox-kernel-helper/tasks/main.yml @@ -0,0 +1,45 @@ +--- +- 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 + 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" |
