[train-only] Set container_client for checks during ffu

Furing FFWD workflow, the validation gets triggered as part of the
pre-upgrade group. When it gets triggered, the environment is in
state where the Undercloud has been upgrade to OSP16.1 (container
engine is podman) but the Overcloud nodes are still on OSP13
(container engine is still docker).

This patch is similar to I46c4fbe0ef7b281d77bff82483eb0b48b4570bb3
to check which container cli should be used.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1963879

Change-Id: I98e42d5d7edb0718660a69fab9c1e6c25af2b138
This commit is contained in:
Martin Schuppert 2021-05-25 17:05:57 +02:00
parent c906f181a0
commit 11218833e5
2 changed files with 15 additions and 5 deletions

View File

@ -30,7 +30,7 @@
include_role:
name: nova_status
vars:
container_cli: docker
container_client: docker
rescue:
- name: Clear host errors

View File

@ -1,12 +1,22 @@
---
- name: Set container_cli fact from the inventory
- name: Check for docker cli
stat:
path: "/var/run/docker.sock"
register: check_docker_cli
check_mode: false
- name: Set container_client fact
set_fact:
container_cli: "{{ hostvars[inventory_hostname].container_cli | default('podman', true) }}"
when: container_cli is not defined
container_client: |-
{% set container_client = 'podman' %}
{% if check_docker_cli.stat.exists|bool %}
{% set container_client = 'docker' %}
{% endif %}
{{ container_client }}
- name: Check nova upgrade status
become: true
command: "{{ container_cli }} exec -u root nova_api nova-status upgrade check"
command: "{{ container_client }} exec -u root nova_api nova-status upgrade check"
changed_when: false
register: nova_upgrade_check