diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-05-06 00:04:09 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-05-06 00:04:09 +0200 |
| commit | 397dfa117941731fa43022b299c933e5375f7a60 (patch) | |
| tree | 70f995fc64cc43ae531304a5f6bc6968e26449d9 /roles/proxmox-kernel-helper/tasks | |
| parent | 2eace6a92436078e189d5961d2cdf5fa0522a5b3 (diff) | |
Add proxmox VE (with kernel helper) on pve.local
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" |
