From d75f329b7cf12c1862ec4a8da17de66502b3f4dd Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Wed, 13 Nov 2024 14:49:09 +0100 Subject: [PATCH] Prevent Grub fix from failing on non-UEFI hosts --- etc/kayobe/ansible/fix-grub-rl9.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/etc/kayobe/ansible/fix-grub-rl9.yml b/etc/kayobe/ansible/fix-grub-rl9.yml index c81402fe6..d1fd3917d 100644 --- a/etc/kayobe/ansible/fix-grub-rl9.yml +++ b/etc/kayobe/ansible/fix-grub-rl9.yml @@ -3,13 +3,19 @@ hosts: overcloud become: yes gather_facts: true - tasks: - - name: Remove "--root-dev-only" from /boot/efi/EFI/rocky/grub.cfg - ansible.builtin.replace: - path: /boot/efi/EFI/rocky/grub.cfg - regexp: '--root-dev-only\s?' - replace: '' + - block: + - name: Check that /boot/efi/EFI/rocky/grub.cfg exists + ansible.builtin.stat: + path: /boot/efi/EFI/rocky/grub.cfg + register: stat_result + + - name: Remove "--root-dev-only" from /boot/efi/EFI/rocky/grub.cfg + ansible.builtin.replace: + path: /boot/efi/EFI/rocky/grub.cfg + regexp: '--root-dev-only\s?' + replace: '' + when: stat_result.stat.exists when: - ansible_facts['distribution'] == 'Rocky' - ansible_facts['distribution_major_version'] == '9'