From 397dfa117941731fa43022b299c933e5375f7a60 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Wed, 6 May 2026 00:04:09 +0200 Subject: Add proxmox VE (with kernel helper) on pve.local --- .../proxmox-kernel-helper/meta/argument_specs.yml | 4 ++ roles/proxmox-kernel-helper/meta/main.yml | 10 +++++ roles/proxmox-kernel-helper/tasks/main.yml | 45 ++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 roles/proxmox-kernel-helper/meta/argument_specs.yml create mode 100644 roles/proxmox-kernel-helper/meta/main.yml create mode 100644 roles/proxmox-kernel-helper/tasks/main.yml (limited to 'roles/proxmox-kernel-helper') diff --git a/roles/proxmox-kernel-helper/meta/argument_specs.yml b/roles/proxmox-kernel-helper/meta/argument_specs.yml new file mode 100644 index 00000000..5af49897 --- /dev/null +++ b/roles/proxmox-kernel-helper/meta/argument_specs.yml @@ -0,0 +1,4 @@ +--- +argument_specs: + main: + options: {} diff --git a/roles/proxmox-kernel-helper/meta/main.yml b/roles/proxmox-kernel-helper/meta/main.yml new file mode 100644 index 00000000..90189e2e --- /dev/null +++ b/roles/proxmox-kernel-helper/meta/main.yml @@ -0,0 +1,10 @@ +--- +galaxy_info: + author: "a14m" + description: "Initialize proxmox-boot-tool EFI boot management via proxmox-kernel-helper" + license: "MIT" + min_ansible_version: "2.18" + platforms: + - name: "Debian" + versions: + - "bookworm" 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" -- cgit v1.2.3