diff --git a/tasks/common/validation_group_run.yaml b/tasks/common/validation_group_run.yaml index 642e755f..77f20779 100644 --- a/tasks/common/validation_group_run.yaml +++ b/tasks/common/validation_group_run.yaml @@ -12,6 +12,7 @@ {{ validation_args|default('') }} 2>&1 {{ timestamper_cmd }} >> validation-{{ validation_group }}.log args: executable: /usr/bin/bash + rescue: - name: Retrieve the validations results command: openstack tripleo validator show history -f json -c UUID -c Status register: validation_history diff --git a/tasks/fast-forward-upgrade/create-undercloud-ffu-scripts.yaml b/tasks/fast-forward-upgrade/create-undercloud-ffu-scripts.yaml index 6ea44490..e149cd84 100644 --- a/tasks/fast-forward-upgrade/create-undercloud-ffu-scripts.yaml +++ b/tasks/fast-forward-upgrade/create-undercloud-ffu-scripts.yaml @@ -3,6 +3,13 @@ include_tasks: ../common/skip_rhel_enforcement.yaml when: not ( enforce_rhel|bool ) +- name: create pre-upgrade validation script for old version + template: + src: "pre-upgrade-osp13-validation.sh.j2" + dest: "{{ working_dir }}/pre-upgrade-validation.sh" + mode: 0775 + force: true + - name: create undercloud upgrade script template: src: "undercloud_upgrade.sh.j2" diff --git a/tasks/fast-forward-upgrade/main.yml b/tasks/fast-forward-upgrade/main.yml index a742af84..bacf08ea 100644 --- a/tasks/fast-forward-upgrade/main.yml +++ b/tasks/fast-forward-upgrade/main.yml @@ -17,6 +17,28 @@ executable: /usr/bin/bash when: ffu_upgrade_workarounds|bool + # At this stage we are running the source OSP version (OSP13), which does not + # support the new tripleo-validations framework. + - name: run pre-upgrade validation before upgrading RHEL + shell: | + set -o pipefail + {{ working_dir }}/pre-upgrade-validation.sh 2>&1 {{ timestamper_cmd }} >> validation-pre-upgrade.log + when: run_validations|bool + tags: + - upgrades_validations + + - name: Check that all validations succeeded + lineinfile: + path: "{{ working_dir }}/validation-pre-upgrade.log" + regexp: "^.*Failure! The validation failed for all hosts:.*$" + state: absent + check_mode: true + register: validation_results + failed_when: validation_results is changed + tags: + - upgrades_validations + when: run_validations|bool + - name: Clean up httpd folder become: true become_user: root @@ -127,6 +149,20 @@ when: ffu_upgrade_workarounds|bool tags: ffu_overcloud_prepare + # At this stage, the Undercloud is in targe version and the overcloud + # in source version. Therefore we can use the tripleo-validation new + # framework, but it is required to pass the python-interpreter + - name: run pre-upgrade validation for the overcloud nodes + import_tasks: ../common/validation_group_run.yaml + vars: + validation_group: "pre-upgrade" + validation_allowed_groups: "{{ upgrades_validations_groups }}" + validation_args: "--python-interpreter /usr/libexec/platform-python" + when: run_validations|bool + tags: + - overcloud_upgrade_prepare + - upgrades_validations + - name: convert nic templates import_tasks: ../common/convert_nic_templates.yaml tags: ffu_overcloud_prepare diff --git a/tasks/upgrade/create-undercloud-upgrade-scripts.yaml b/tasks/upgrade/create-undercloud-upgrade-scripts.yaml index 2b22f708..0ae17b05 100644 --- a/tasks/upgrade/create-undercloud-upgrade-scripts.yaml +++ b/tasks/upgrade/create-undercloud-upgrade-scripts.yaml @@ -3,13 +3,6 @@ include_tasks: ../common/skip_rhel_enforcement.yaml when: not ( enforce_rhel|bool ) -- name: create pre-upgrade validation script for old version - template: - src: "pre-upgrade-osp13-validation.sh.j2" - dest: "{{ working_dir }}/pre-upgrade-validation.sh" - mode: 0775 - force: true - - name: create undercloud upgrade script template: src: "undercloud_upgrade.sh.j2" diff --git a/tasks/upgrade/main.yml b/tasks/upgrade/main.yml index e2e22f05..0c3046c9 100644 --- a/tasks/upgrade/main.yml +++ b/tasks/upgrade/main.yml @@ -20,16 +20,6 @@ chdir: "{{ working_dir }}" when: upgrade_workarounds|bool - # At this stage we are running the source OSP version (OSP13), which does not - # support the new tripleo-validations framework. - - name: run pre-upgrade validation before upgrading RHEL - shell: | - set -o pipefail - {{ working_dir }}/pre-upgrade-validation.sh 2>&1 {{ timestamper_cmd }} >> validation-pre-upgrade.log - when: run_validations|bool - tags: - - upgrades_validations - - name: Upgrade operating system become: true become_user: root @@ -109,20 +99,6 @@ when: upgrade_workarounds tags: overcloud_upgrade_prepare - # At this stage, the Undercloud is in targe version and the overcloud - # in source version. Therefore we can use the tripleo-validation new - # framework, but it is required to pass the python-interpreter - - name: run pre-upgrade validation for the overcloud nodes - import_tasks: ../common/validation_group_run.yaml - vars: - validation_group: "pre-upgrade" - validation_allowed_groups: "{{ upgrades_validations_groups }}" - validation_args: "--python-interpreter /usr/libexec/platform-python" - when: run_validations|bool - tags: - - overcloud_upgrade_prepare - - upgrades_validations - - import_tasks: overcloud_upgrade_prepare.yml tags: overcloud_upgrade_prepare