Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Improve Ceph health checks to work with custom cluster names
Browse files Browse the repository at this point in the history
When the Ceph cluster name is customized the ceph commands need
to be told the custom cluster name.

Change-Id: Ic17307efc2b4907cc21df8289a2e0c84d2f30b48
  • Loading branch information
gfidente committed Aug 2, 2019
1 parent 0204d76 commit ff4d7ce
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions roles/ceph/tasks/ceph-health.yaml
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff4d7ce

Please sign in to comment.