Merge "Introducing tripleo_delegate_to on ceph health validation"

This commit is contained in:
Zuul 2020-04-30 23:59:45 +00:00 committed by Gerrit Code Review
commit 625c3cef85
3 changed files with 21 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_cli = '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