Improve Ceph health checks to work with custom cluster names

When the Ceph cluster name is customized the ceph commands need
to be told the custom cluster name.

Change-Id: Ic17307efc2b4907cc21df8289a2e0c84d2f30b48
This commit is contained in:
Giulio Fidente 2019-08-02 10:08:06 +02:00
parent 0204d7665c
commit ff4d7ceec5
1 changed files with 9 additions and 2 deletions

View File

@ -29,9 +29,16 @@
- ceph_mon_enabled is succeeded
- ceph_mon_container is succeeded
block:
- name: Set ceph cluster name
become: true
shell: find /etc/ceph -name '*.conf' -exec basename -s .conf {} \; 2>/dev/null | head -n1
ignore_errors: true
register: ceph_cluster_name
changed_when: False
- name: Get ceph health
become: true
shell: "{{ container_cli }} exec {{ ceph_mon_container.stdout }} ceph health | awk '{print $1}'"
shell: "{{ container_cli }} exec {{ ceph_mon_container.stdout }} ceph --cluster {{ ceph_cluster_name }} health | awk '{print $1}'"
register: ceph_health
- name: Check ceph health
@ -59,7 +66,7 @@
- name: Get OSD stat percentage
become: true
shell: "{{ container_cli }} exec {{ ceph_mon_container.stdout }} ceph osd stat -f json | jq '{{ jq_osd_percentage_filter }}'"
shell: "{{ container_cli }} exec {{ ceph_mon_container.stdout }} ceph --cluster {{ ceph_cluster_name }} osd stat -f json | jq '{{ jq_osd_percentage_filter }}'"
register: ceph_osd_in_percentage
- name: Fail if there is an unacceptable percentage of in OSDs