Validation checks for presence of deprecated services in the role data

This is intended to prevent issues caused by presence of deprecated services during FFU
from 16.2 to 17.1.

Role uses information retrieved from `/usr/share/openstack-tripleo-heat-templates/roles` to obtain
list of defined services on undercloud.

Depends-On: https://review.opendev.org/c/openstack/tripleo-ansible/+/862150

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I954e89e9b6980427ef5dbbea380103facd271b58
This commit is contained in:
Jiri Podivin 2022-11-24 09:24:04 +01:00
parent 9960993bae
commit b0c1779c85
4 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,6 @@
===================
deprecated_services
===================
.. ansibleautoplugin::
:role: roles/deprecated_services

View File

@ -0,0 +1,19 @@
---
- hosts: undercloud
gather_facts: false
vars:
metadata:
name: Check if roles data doesn't include deprecated services
description: |
Validate that the custom roles_data.yaml provided in the upgrade prepare step doesn't have any deprecated services.
This has been an issue among customers for a long time, which has been addressed by documentation.
However, we should have some way to alert the user that the roles_data they provide has deprecated services
before starting the upgrade procedure and getting an ugly error.
groups:
- pre-upgrade
categories:
- undercloud
products:
- tripleo
roles:
- deprecated_services

View File

@ -0,0 +1,2 @@
---
deprecated_service_list: []

View File

@ -0,0 +1,42 @@
---
# Copyright 2022 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Retrieve roles list
tripleo_overcloud_role_list:
register: role_list
- name: Retrieve roles data
tripleo_overcloud_role_show:
role_name: "{{ item }}"
loop: "{{ role_list.role_list }}"
register: roles_data
- name: Get defined sevices
set_fact:
defined_services: "{{ roles_data.results | community.general.json_query('[*].role_detail.ServicesDefault') |
flatten | unique | map('split', '::') | map('last') }}"
- name: Check for deprecated services
set_fact:
deprecated_services_in_roles: "{{ deprecated_service_list | intersect(defined_services) }}"
- name: Fail if deprecated service list isn't empty
fail:
msg: >
Following services are marked as deprecated and should be removed
from roles data before upgrade:
{{ deprecated_services_in_roles }}
when: deprecated_services_in_roles