Force facts cache refreshing after OS upgrade.

When upgrading from Rocky to Stein, an upgrade of the operating system is
performed. This upgrade from RHEL7 to RHEL8 implies the removal of the
default /usr/bin/python binary. As the facts cache is enabled, Ansible's
strategy does not consider to upgrade facts and therefore we try to run the
ansible playbook using the old python binary when running the upgrade.
This fails with the error: /usr/bin/python: No such file or directory.

This patch makes use of the setup task in combination with clear_facts
right after rebooting to upgrade the operating system, to ensure that
the facts are gathered and refreshed for the Overcloud node just upgraded.
This way, we make sure that we are using the right python binary.

Closes-Bug: #1856313
Change-Id: Ia1fa60c22e482ab14a509730cf93634772e077a7
(cherry picked from commit 598cf6977f)
(cherry picked from commit 0cd97e44cd)
This commit is contained in:
Jose Luis Franco Arza 2020-01-30 10:54:58 +01:00 committed by Jose Luis Franco
parent 79e0e3734d
commit b873e1e620
1 changed files with 7 additions and 2 deletions

View File

@ -154,12 +154,17 @@ outputs:
# but doesn't want to reboot, they can run with
# `--skip-tags system_upgrade_reboot`.
- system_upgrade_reboot
when: step|int == 4
when:
- step|int == 4
- upgrade_leapp_enabled
block:
- name: reboot to perform the upgrade
reboot:
reboot_timeout: "{{upgrade_leapp_reboot_timeout}}"
when: upgrade_leapp_enabled
- name: Clear gathered facts from all currently targeted hosts
meta: clear_facts
- name: Force facts refresh after OS upgrade to refresh cache.
setup:
- name: Package and repo update tasks
when: step|int == 0