Add OS version to check reboot happened

In some cases OS of VM shuts down very slowly. After post_reboot_delay
(120 sec) ansible logs in to VM and runs "systemctl
is-system-running | grep -qE "running|degraded" which works perfectly on
RHEL/CentOS 7/8. Ansible will be puzzled as it doesn't detect any other
statuses. This issue was solved in ansible 2.10 by redesigning reboot
module where "boot_time_command" verifies boot_id before and after
reboot. However, we cannot backport ansible 2.10 to product so this
patch adds a little check to detect OS version to keep it simple. This
works as leapp installs RHEL8 in disconnected mode after reboot, ansible
won't be able to connect until leapp is done.

Resolves: rhbz#1980542

Change-Id: I6190ee794dce461077b08b486aef18cbf9cc04b3
This commit is contained in:
Sergii Golovatiuk 2021-07-12 18:03:42 +02:00 committed by Jesse Pretorius
parent 0b874947a1
commit 2b33594c19
1 changed files with 2 additions and 1 deletions

View File

@ -252,8 +252,9 @@ outputs:
- name: reboot to perform the upgrade
reboot:
reboot_timeout: "{{upgrade_leapp_reboot_timeout}}"
# TODO(holser): ansible 2.10 and higher provides boot_time_command to detect boot_id before and after reboot.
test_command: >-
systemctl is-system-running | grep -e running -e degraded
source /etc/os-release; [ "${VERSION_ID%.*}" -ge "8" ] && systemctl is-system-running | grep -qE "running|degraded" || exit 1
post_reboot_delay: "{{ upgrade_leapp_post_reboot_delay }}"
- name: Package and repo update tasks