6406ef8bd8
This patch adds tools/ansible-lint.sh script to lint validations playbooks. Moreover, it adds `changed_when: False` to commands that should not change things if nothing needs doing [ANSIBLE0012]. Change-Id: I4fb432bfbd2b73740c29011d08a09058b6c45348 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
31 lines
827 B
YAML
31 lines
827 B
YAML
---
|
|
- 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
|
|
changed_when: False
|
|
- 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'
|