diff --git a/roles/ceph/tasks/ceph-health.yaml b/roles/ceph/tasks/ceph-health.yaml index b92ed54b..3e502025 100644 --- a/roles/ceph/tasks/ceph-health.yaml +++ b/roles/ceph/tasks/ceph-health.yaml @@ -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