From 4dd513cee67750fafa5646b96f1afb9874e8ca0f Mon Sep 17 00:00:00 2001 From: "Gael Chamoulaud (Strider)" Date: Thu, 27 May 2021 12:02:42 +0200 Subject: [PATCH] [train-only] Set oc_container_cli 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=1963872 Signed-off-by: Gael Chamoulaud (Strider) Change-Id: I15b105d03193a83ab7bbf3e911cbb37974a54495 --- roles/container_status/tasks/main.yaml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/roles/container_status/tasks/main.yaml b/roles/container_status/tasks/main.yaml index 279a0d466..7d479acdb 100644 --- a/roles/container_status/tasks/main.yaml +++ b/roles/container_status/tasks/main.yaml @@ -1,10 +1,20 @@ --- -- name: Set oc_container_cli fact for the Overcloud nodes - set_fact: - oc_container_cli: "{{ hostvars[inventory_hostname].container_cli | default('podman', true) }}" - when: - - "'overcloud' in group_names" - - oc_container_cli is not defined +- when: "'overcloud' in group_names" + block: + - name: Check for docker cli + stat: + path: "/var/run/docker.sock" + register: check_docker_cli + check_mode: false + + - name: Set oc_container_cli fact for the Overcloud nodes + set_fact: + oc_container_cli: |- + {% set oc_container_cli = 'podman' %} + {% if check_docker_cli.stat.exists|bool %} + {% set oc_container_cli = 'docker' %} + {% endif %} + {{ oc_container_cli }} - when: "'Undercloud' in group_names" block: