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:
parent
e794bac656
commit
bb344b093d
6
doc/source/roles/role-check_reboot.rst
Normal file
6
doc/source/roles/role-check_reboot.rst
Normal file
@ -0,0 +1,6 @@
|
||||
============
|
||||
check_reboot
|
||||
============
|
||||
|
||||
.. ansibleautoplugin::
|
||||
:role: roles/check_reboot
|
22
playbooks/check-reboot.yaml
Normal file
22
playbooks/check-reboot.yaml
Normal 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
|
3
roles/check_reboot/defaults/main.yaml
Normal file
3
roles/check_reboot/defaults/main.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
fail_if_reboot: true
|
||||
no_reboot_message: "Reboot should not be necessary."
|
18
roles/check_reboot/tasks/main.yaml
Normal file
18
roles/check_reboot/tasks/main.yaml
Normal 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
|
Loading…
x
Reference in New Issue
Block a user