Check for Ceph status in post-deployment

Emits a Warning: message if Ceph is in HEALTH_WARN state

Change-Id: Ib6840ed656b8f65defe2f05733cb3cc10da48aca
This commit is contained in:
Giulio Fidente 2017-02-20 16:10:51 -05:00 committed by Martin André
parent 311411122b
commit 6496b30ad2
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds a ceph-health check which prints a warning message if Ceph cluster
is in HEALTH_WARN state at the end of the Overcloud deployment

View File

@ -0,0 +1,29 @@
---
- hosts: controller
vars:
metadata:
name: Check the status of the ceph cluster
description: >
Uses `ceph health` to check if cluster is in HEALTH_WARN state
and prints a debug message.
groups:
- post-deployment
tasks:
- name: Check if ceph_mon is deployed
become: true
shell: hiera -c /etc/puppet/hiera.yaml enabled_services | egrep -sq ceph_mon
ignore_errors: true
register: ceph_mon_enabled
- name: Get ceph health
become: true
shell: ceph health | awk '{print $1}'
register: ceph_health
when:
- ceph_mon_enabled|succeeded
- name: Check ceph health
warn:
msg: Ceph is in {{ ceph_health.stdout }} state.
when:
- ceph_mon_enabled|succeeded
- ceph_health.stdout == 'HEALTH_WARN'