From ddae06e1a23db7a8e45a7adc22421212bc0dedfa Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Mon, 7 Feb 2022 16:08:40 +0100 Subject: [PATCH] adopt: check for POOL_APP_NOT_ENABLED warning This commit makes the cephadm-adopt playbook fail if the cluster has the `POOL_APP_NOT_ENABLED` warning raised. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2040243 Signed-off-by: Guillaume Abrioux --- infrastructure-playbooks/cephadm-adopt.yml | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/infrastructure-playbooks/cephadm-adopt.yml b/infrastructure-playbooks/cephadm-adopt.yml index 6d5c2114a3..1db4921490 100644 --- a/infrastructure-playbooks/cephadm-adopt.yml +++ b/infrastructure-playbooks/cephadm-adopt.yml @@ -86,6 +86,26 @@ name: ceph-facts tasks_from: container_binary.yml + - name: set_fact ceph_cmd + set_fact: + ceph_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph:/var/lib/ceph:ro -v /var/run/ceph:/var/run/ceph:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph' }} --cluster {{ cluster }}" + + - name: check pools have an application enabled + command: "{{ ceph_cmd }} health detail --format json" + register: health_detail + run_once: true + changed_when: false + delegate_to: "{{ groups[mon_group_name][0] }}" + + - name: check for POOL_APP_NOT_ENABLED warning + fail: + msg: "Make sure all your pool have an application enabled." + run_once: true + delegate_to: localhost + when: + - (health_detail.stdout | default('{}', True) | from_json)['status'] == "HEALTH_WARN" + - "'POOL_APP_NOT_ENABLED' in (health_detail.stdout | default('{}', True) | from_json)['checks']" + - import_role: name: ceph-facts tasks_from: convert_grafana_server_group_name.yml @@ -193,10 +213,6 @@ - not containerized_deployment | bool - mgr_group_name in group_names - - name: set_fact ceph_cmd - set_fact: - ceph_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph:/var/lib/ceph:ro -v /var/run/ceph:/var/run/ceph:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph' }} --cluster {{ cluster }}" - - name: get current fsid command: "{{ ceph_cmd }} fsid" register: current_fsid