summaryrefslogtreecommitdiff
path: root/roles/install-grub/tasks
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2021-01-23 23:41:52 +0200
committerzsdc <taras@vyos.io>2021-03-15 19:48:41 +0200
commit1d711c0159a7b8abbc7c801f9b4b2ff08a615317 (patch)
tree0084503c95db4791f420a7464ac781d5aacf3062 /roles/install-grub/tasks
parent430392dc3e8385567f97f56c8107130968709227 (diff)
downloadvyos-vm-images-1d711c0159a7b8abbc7c801f9b4b2ff08a615317.tar.gz
vyos-vm-images-1d711c0159a7b8abbc7c801f9b4b2ff08a615317.zip
Added partition table type select option (MBR/GPT/hybrid)
Since some of the build target platforms do not support hybrid partition table and require only MBR (AWS AMI), was added option that allows selecting a partition table type: ``` -e parrtable_type=type ``` where `type` can be one of: `mbr`, `gpt`, `hybrid`. Default value is `hybrid`.
Diffstat (limited to 'roles/install-grub/tasks')
-rw-r--r--roles/install-grub/tasks/main.yml12
1 files changed, 8 insertions, 4 deletions
diff --git a/roles/install-grub/tasks/main.yml b/roles/install-grub/tasks/main.yml
index 974f011..608d002 100644
--- a/roles/install-grub/tasks/main.yml
+++ b/roles/install-grub/tasks/main.yml
@@ -27,20 +27,24 @@
- name: Mount EFI
become: true
mount:
- src: "{{ vyos_target_drive }}p2"
+ src: "{{ vyos_target_drive }}p{{ partition_num_efi }}"
path: "{{ vyos_install_root }}/boot/efi"
fstype: vfat
state: mounted
+ when: partition_num_efi is defined
- name: Install GRUB in the boot sector of {{ vyos_target_drive }}
become: true
command: "chroot {{ vyos_install_root }} grub-install --no-floppy --target=i386-pc --root-directory=/boot {{ loop_device.stdout }} --force"
args:
creates: "{{ vyos_install_root }}/boot/grub/grubenv"
+ when: (vyos_parttable_type == "mbr") or
+ (vyos_parttable_type == "hybrid")
-- name: Install EFI GRUB to {{ vyos_target_drive }}p2
+- name: Install EFI GRUB to {{ vyos_target_drive }}p{{ partition_num_efi }}
become: true
command: "chroot {{ vyos_install_root }} grub-install --no-floppy --recheck --target=x86_64-efi --force-extra-removable --root-directory=/boot --efi-directory=/boot/efi --bootloader-id='VyOS' --no-uefi-secure-boot"
+ when: partition_num_efi is defined
- name: Configure GRUB
become: true
@@ -52,8 +56,8 @@
- name: Unmount EFI
become: true
mount:
- src: "{{ vyos_target_drive }}p2"
+ src: "{{ vyos_target_drive }}p{{ partition_num_efi }}"
path: "{{ vyos_install_root }}/boot/efi"
fstype: vfat
state: absent
-
+ when: partition_num_efi is defined