From 67560d36c06860dc827ef8356f1023f42facdbec Mon Sep 17 00:00:00 2001 From: Giulio Fidente Date: Mon, 15 Feb 2021 16:43:11 +0100 Subject: [PATCH] Optionally fail ceph-health if HEALTH_WARN Helps controlling the behavior of the ceph-health check for it to fail, optionally, not only when cluster is in _ERR state but also in _WARN state. Change-Id: I4eb7508c24cce0db3179d4f3ef26cabceb164716 Related-Bug: 1915700 --- roles/ceph/defaults/main.yml | 1 + roles/ceph/tasks/ceph-health.yaml | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/roles/ceph/defaults/main.yml b/roles/ceph/defaults/main.yml index d75731e2a..f4e5c9c7c 100644 --- a/roles/ceph/defaults/main.yml +++ b/roles/ceph/defaults/main.yml @@ -2,6 +2,7 @@ fail_without_ceph_ansible: false fail_without_deps: false fail_on_ceph_health_err: false +fail_on_ceph_health_warn: false osd_percentage_min: 0 ceph_ansible_repo: "centos-ceph-nautilus" container_client: "podman" diff --git a/roles/ceph/tasks/ceph-health.yaml b/roles/ceph/tasks/ceph-health.yaml index 641434b06..fa59a7f60 100644 --- a/roles/ceph/tasks/ceph-health.yaml +++ b/roles/ceph/tasks/ceph-health.yaml @@ -53,6 +53,13 @@ - ceph_health.stdout != 'HEALTH_OK' - not fail_on_ceph_health_err|default(true)|bool + - name: Fail if ceph health is HEALTH_WARN + fail: + msg: Ceph is in {{ ceph_health.stdout }} state. + when: + - ceph_health.stdout == 'HEALTH_WARN' + - fail_on_ceph_health_warn|default(false)|bool + - name: Fail if ceph health is HEALTH_ERR fail: msg: Ceph is in {{ ceph_health.stdout }} state.