diff options
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/bootstrap/tasks/install-proxmox.yml | 63 | ||||
| -rw-r--r-- | roles/bootstrap/templates/refind_proxmox.conf.j2 | 19 | ||||
| -rw-r--r-- | roles/bootstrap/vars/proxmox.yml | 6 |
3 files changed, 25 insertions, 63 deletions
diff --git a/roles/bootstrap/tasks/install-proxmox.yml b/roles/bootstrap/tasks/install-proxmox.yml index 7a3b92a..57278b7 100644 --- a/roles/bootstrap/tasks/install-proxmox.yml +++ b/roles/bootstrap/tasks/install-proxmox.yml @@ -37,8 +37,6 @@ mode: "0640" content: "{{ item.content }}" loop: - - dest: "{{ mnt_root_path }}/etc/apt/preferences.d/ignored-package" - content: "{{ bootstrap_apt_ignored_preferences }}" - 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" @@ -52,49 +50,36 @@ - "apt-get update" - "apt-get install -y {{ bootstrap_distro.packages | join(' ') }}" -- name: "Ensure rEFInd package installed" +- name: "Mount EFI partition inside chroot for grub-install" ansible.builtin.command: - cmd: "arch-chroot {{ mnt_root_path }} apt-get install -y refind" + cmd: "mount --bind {{ mnt_boot_path }} {{ mnt_root_path }}/boot/efi" changed_when: true + tags: ["molecule-notest"] -- name: "Install rEFInd to EFI partition" +- name: "Install grub to EFI partition" ansible.builtin.command: - cmd: "arch-chroot {{ mnt_root_path }} refind-install" + 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: "Ensure proxmox EFI boot directory exists" - ansible.builtin.file: - path: "{{ mnt_boot_path }}/EFI/proxmox" - state: directory - mode: "0755" - -- name: "Copy kernel to EFI partition" - ansible.builtin.shell: - cmd: | - cp {{ mnt_root_path }}/boot/vmlinuz-*-pve {{ mnt_boot_path }}/EFI/proxmox/vmlinuz - cp {{ mnt_root_path }}/boot/initrd.img-*-pve {{ mnt_boot_path }}/EFI/proxmox/initrd.img +- name: "Generate grub configuration" + ansible.builtin.command: + cmd: "arch-chroot {{ mnt_root_path }} update-grub" changed_when: true - -- name: "Configure rEFInd" - ansible.builtin.template: - src: "refind_proxmox.conf.j2" - dest: "{{ mnt_boot_path }}/EFI/BOOT/refind.conf" - mode: "0644" - # NOTE: this is skipped because the docker test doesn't have proper EFI/refind directory created - # NOTE: Debian's refind-install falls back to EFI/BOOT/ when NVRAM entries can't be registered in chroot + # NOTE: requires kernel to be installed — not available in Docker test tags: ["molecule-notest"] -- name: "Ensure kernel post-install hook directory exists" - ansible.builtin.file: - path: "{{ mnt_root_path }}/etc/kernel/postinst.d" - state: directory - mode: "0755" - -- name: "Install kernel sync script for EFI partition" - ansible.builtin.copy: - dest: "{{ mnt_root_path }}/etc/kernel/postinst.d/refind-sync-kernel" - mode: "0755" - content: | - #!/bin/sh - cp $(ls -t /boot/vmlinuz-*-pve | head -1) /boot/efi/EFI/proxmox/vmlinuz - cp $(ls -t /boot/initrd.img-*-pve | head -1) /boot/efi/EFI/proxmox/initrd.img +- name: "Unmount EFI partition from chroot" + ansible.builtin.command: + cmd: "umount {{ mnt_root_path }}/boot/efi" + changed_when: true + tags: ["molecule-notest"] diff --git a/roles/bootstrap/templates/refind_proxmox.conf.j2 b/roles/bootstrap/templates/refind_proxmox.conf.j2 deleted file mode 100644 index e38c223..0000000 --- a/roles/bootstrap/templates/refind_proxmox.conf.j2 +++ /dev/null @@ -1,19 +0,0 @@ -timeout 5 -textonly true -scan_all_linux_kernels false -dont_scan_files vmlinuz,vmlinuz-linux,initrd.img,initramfs-linux.img -hideui hints - -menuentry "Proxmox VE" { - volume "boot" - loader \EFI\proxmox\vmlinuz - initrd \EFI\proxmox\initrd.img - options "root=PARTLABEL={{ partition_root.name }} rw rootwait console=tty1{% if bootstrap_mac %} {{ bootstrap_mac_boot_args }}{% endif %}" -} - -menuentry "Proxmox VE (terminal)" { - volume "boot" - loader \EFI\proxmox\vmlinuz - initrd \EFI\proxmox\initrd.img - options "root=PARTLABEL={{ partition_root.name }} rw rootwait console=tty1 systemd.unit=multi-user.target{% if bootstrap_mac %} {{ bootstrap_mac_boot_args }}{% endif %}" -} diff --git a/roles/bootstrap/vars/proxmox.yml b/roles/bootstrap/vars/proxmox.yml index 9833ad3..0b0e62e 100644 --- a/roles/bootstrap/vars/proxmox.yml +++ b/roles/bootstrap/vars/proxmox.yml @@ -4,14 +4,10 @@ bootstrap_distro: mirror_url: "http://deb.debian.org/debian" packages: - "proxmox-default-kernel" + - "proxmox-grub" bootstrap_opts: "" -bootstrap_apt_ignored_preferences: | - Package: grub-common grub2-common grub-pc grub-pc-bin - Pin: release * - Pin-Priority: -1 - bootstrap_apt_sources: | deb http://deb.debian.org/debian bookworm main contrib deb http://deb.debian.org/debian bookworm-updates main contrib |
