Handle generating grub config for EFI partitions

The default overcloud-full image uses grub config path
/boot/grub2/grub.cfg however images with EFI boot partitions use grub
config path /boot/efi/EFI/redhat/grub.cfg.

This means for EFI based images, persisting kernel boot args is
currently broken. This change fixes this by checking a known list of
grub.cfg paths and regenerating the config for each file which already
exists.

Change-Id: I9ef130a3f437c82e9e3ec2f2bc82df3ea45c410f
Closes-Bug: #1877215
This commit is contained in:
Steve Baker 2020-05-07 14:38:49 +12:00
parent 3e1e723ce2
commit 4cf48e9b75
1 changed files with 12 additions and 2 deletions

View File

@ -31,8 +31,18 @@
dest: /etc/default/grub
line: 'GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX:+$GRUB_CMDLINE_LINUX }${TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS}"'
insertafter: '^TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS.*'
- name: Generate grub config file
command: grub2-mkconfig -o /boot/grub2/grub.cfg
- name: Check grub config paths
stat:
path: "{{ item }}"
register: grub_stat
loop:
- /boot/grub2/grub.cfg
- /boot/efi/EFI/redhat/grub.cfg
- /boot/efi/EFI/fedora/grub.cfg
- name: Generate grub config
command: "grub2-mkconfig -o {{ item.stat.path }}"
when: item.stat.exists|bool
loop: "{{ grub_stat.results }}"
- name: Set reboot required fact
set_fact:
reboot_required: true