Only enable leapp tasks when distribution is correct

To enable idempotence in the leapp process, even if the tasks
complete a previous partial run, we add another condition over
and above the 'UpgradeLeappEnabled' heat parameter which checks
that the distribution is RedHat (CentOS does not support the
leapp tool) and distribution version is 7 (if it's 8 then the
leapp process is complete already for this host).

NOTE: This patch was originally merged like [0], due to the
dependency between pacemaker managed services and upgrade_
leapp_enabled it had to be reverted in [1]. A fix was submitted
to remove that dependency in [2], so merging it back adapted.

[0] - Ia58e2f7853056d8a4f0a54f35d91743bf0d9f2ed
[1] - I95fa9f263e89e0ed99bc42e3966acbe5973c4cc9
[2] - Iba85e99f59258ce6ef4e05ccae737b9eeb6cfc57

Co-Authored-By: Jesse Pretorius <jesse@odyssey4.me>

Change-Id: Ie3bc270fd06c32f9bad05447925640e98bdf32a4
(cherry picked from commit 13326b564f)
This commit is contained in:
Jose Luis Franco Arza 2020-06-10 14:44:02 +02:00
parent 576aa8f410
commit 8a8cf9a5d5
1 changed files with 18 additions and 3 deletions

View File

@ -119,14 +119,29 @@ outputs:
step_config: |
include tripleo::packages
upgrade_tasks:
- name: set leapp facts
tags: always
- name: Gather missing facts
setup:
gather_subset: "distribution"
when: >-
ansible_facts['distribution'] is not defined or
ansible_facts['distribution_major_version'] is not defined
tags:
- always
- name: Set leapp facts
set_fact:
upgrade_leapp_enabled: {get_param: UpgradeLeappEnabled}
upgrade_leapp_enabled: >-
{{ _upgradeLeappEnabled | bool and
ansible_facts['distribution'] == 'RedHat' and
ansible_facts['distribution_major_version'] is version('7', '==') }}
upgrade_leapp_debug: {get_param: UpgradeLeappDebug}
upgrade_leapp_devel_skip: {get_param: UpgradeLeappDevelSkip}
upgrade_leapp_command_options: {get_param: UpgradeLeappCommandOptions}
upgrade_leapp_reboot_timeout: {get_param: UpgradeLeappRebootTimeout}
vars:
_upgradeLeappEnabled: {get_param: UpgradeLeappEnabled}
tags:
- always
- name: system_upgrade_prepare step 3
tags: