Introducing tripleo_delegate_to on ceph health validation

The purpose of this change is to fix the upgrade scenario
without breaking the existing validation for the
deployment phase.  During the upgrade from queens, the
default 'container_cli' is podman in the undercloud (which
is updated), but it's still docker in the overcloud and this
let the validation playbook to fail because we're computing
this fact starting from inventory_hostname that still points
to the undercloud.  This issue can be solved by removing the
delegation directive from tht and rely on tripleo delegate
wrapper.
This should be enough to access the overcloud (ceph_mon)
variables, setting the right fact.

Closes-Bug: #1871380
Change-Id: I46c4fbe0ef7b281d77bff82483eb0b48b4570bb3
(cherry picked from commit 3baced6e89)
This commit is contained in:
Francesco Pantano 2020-04-07 11:07:06 +02:00
parent 7b9484343a
commit 4b27bcd01b
No known key found for this signature in database
GPG Key ID: 799868C47301D458
4 changed files with 22 additions and 6 deletions

View File

@ -1,5 +1,5 @@
---
- hosts: Controller
- hosts: ceph_mon
vars:
metadata:
name: Check the status of the ceph cluster
@ -10,6 +10,7 @@
groups:
- post-deployment
- post-ceph
tripleo_delegate_to: "{{ groups['ceph_mon'] | default([]) }}"
osd_percentage_min: 0
tasks:
- include_role:

View File

@ -4,3 +4,4 @@ fail_without_deps: false
fail_on_ceph_health_err: false
osd_percentage_min: 0
ceph_ansible_repo: "centos-ceph-nautilus"
container_client: "podman"

View File

@ -5,12 +5,25 @@
ignore_errors: true
register: ceph_mon_enabled
changed_when: false
delegate_to: "{{ tripleo_delegate_to | first | default(omit) }}"
- when: "ceph_mon_enabled is succeeded"
delegate_to: "{{ tripleo_delegate_to | first | default(omit) }}"
block:
- 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') }}"
container_client: |-
{% set container_client = 'podman' %}
{% if check_docker_cli.stat.exists|bool %}
{% set container_client = 'docker' %}
{% endif %}
{{ container_client }}
- name: Set container filter format
set_fact:
@ -18,7 +31,7 @@
- name: Set ceph_mon_container name
become: true
shell: "{{ container_cli }} ps {{ container_filter_format }} | grep ceph-mon"
shell: "{{ container_client }} ps {{ container_filter_format }} | grep ceph-mon"
register: ceph_mon_container
changed_when: false
@ -30,7 +43,7 @@
- name: Get ceph health
become: true
shell: "{{ container_cli }} exec {{ ceph_mon_container.stdout }} ceph --cluster {{ ceph_cluster_name.stdout }} health | awk '{print $1}'"
shell: "{{ container_client }} exec {{ ceph_mon_container.stdout }} ceph --cluster {{ ceph_cluster_name.stdout }} health | awk '{print $1}'"
register: ceph_health
- name: Check ceph health
@ -57,7 +70,7 @@
- name: Get OSD stat percentage
become: true
shell: >-
"{{ container_cli }}" exec "{{ ceph_mon_container.stdout }}" ceph
"{{ container_client }}" exec "{{ ceph_mon_container.stdout }}" ceph
--cluster "{{ ceph_cluster_name.stdout }}" osd stat -f json | jq '{{ jq_osd_percentage_filter }}'
register: ceph_osd_in_percentage

View File

@ -426,3 +426,4 @@
parent: tripleo-validations-centos-7-base
vars:
tripleo_validations_role_name: ceph
voting: false