Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Distinguish between EL 7 workarounds and proper config tasks #99

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
{{ __bootloader_default_grub }}
cat {{ __bootloader_default_grub }}
changed_when: true
when:
- ansible_distribution in ['CentOS', 'RedHat']
- ansible_distribution_version is version('8', '<')

- name: Reboot system
include_tasks: tasks/reboot.yml

# This doesn't work on EL 7. EL 7 has it's workaround in tasks/main.yml
- name: Regenerate grub config
command: grub2-mkconfig -o {{ __bootloader_grub_conf }}
when: >-
not (ansible_distribution in ['CentOS', 'RedHat'] and
ansible_distribution_version is version('8', '<'))
spetrosi marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 7 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,26 @@
set_fact:
__bootloader_grub_conf: /boot/grub2/grub.cfg

- name: >-
Update boot loader timeout configuration in {{ __bootloader_default_grub }}
- name: Update timeout configuration in {{ __bootloader_default_grub }}
replace:
path: "{{ __bootloader_default_grub }}"
regexp: '^GRUB_TIMEOUT=.*'
replace: 'GRUB_TIMEOUT={{ bootloader_timeout }}'
mode: "{{ __bootloader_default_grub_stat.stat.exists |
ternary(__bootloader_default_grub_stat.stat.mode, '0644') }}"
notify: Regenerate grub config

- name: Update boot loader timeout configuration in {{ __bootloader_grub_conf }}
# Regenerate grub config doesn't work on EL 7, need to edit config manually
- name: On EL 7, update timeout configuration in {{ __bootloader_grub_conf }}
replace:
path: "{{ __bootloader_grub_conf }}"
regexp: 'set timeout=.*'
replace: 'set timeout={{ bootloader_timeout }}'
mode: "{{ __bootloader_grub_conf_stat.stat.exists |
ternary(__bootloader_grub_conf_stat.stat.mode, '0644') }}"
when:
- ansible_distribution in ['CentOS', 'RedHat']
- ansible_distribution_version is version('8', '<')

- name: Ensure boot loader settings
bootloader_settings:
Expand Down
Loading