Add validation to check if a reboot of a node is necessary

For Upgrade usage, this validation will check with yum-utils
if a reboot is needed by some core packages according to:
https://access.redhat.com/solutions/27943

Change-Id: Ib0ec55bfb4614b1415ab61a0077c34f4d147d43d
This commit is contained in:
matbu 2022-11-17 11:01:21 +01:00
parent e794bac656
commit bb344b093d
4 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,6 @@
============
check_reboot
============
.. ansibleautoplugin::
:role: roles/check_reboot

View File

@ -0,0 +1,22 @@
---
- hosts: all
gather_facts: true
vars:
metadata:
name: Verify if a reboot is necessary with yum-utils
description: |
This validation checks if a reboot is necessary with yum-utils
with the option: needs-restarting -r
groups:
- pre-upgrade
- pre-update
- post-upgrade
- post-update
categories:
- os
- kernel
- system
products:
- tripleo
roles:
- check_reboot

View File

@ -0,0 +1,3 @@
---
fail_if_reboot: true
no_reboot_message: "Reboot should not be necessary."

View File

@ -0,0 +1,18 @@
---
- name: Make sure yum-utils is installed
become: true
package:
name: yum-utils
- name: Check if reboot is required
register: command_output
shell: |
needs-restarting -r
- name: Fail if core packages need reboot
fail:
msg: |
{{ command_output.stdout }}
when:
- no_reboot_message not in command_output.stdout
- fail_if_reboot