tripleo-validations/validations/pacemaker-status.yaml
Gael Chamoulaud 216788c320 Run pcs command only if the pacemaker service is active
This patch checks first if the pacemaker service is active on the Controller
before to run 'pcs status xml' command. This will avoid the validation to fail
miserably on a non-HA deployment.

Change-Id: I10e5d11f929f3b0fce02d5e82437aca9d35cf271
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2018-11-27 17:41:50 +01:00

31 lines
972 B
YAML

---
- hosts: Controller
vars:
metadata:
name: Check the status of the pacemaker cluster
description: >
This runs `pcs status` and checks for any failed actions.
A failed status post-deployment indicates something is not configured
correctly. This should also be run before upgrade as the process will
likely fail with a cluster that's not completely healthy.
groups:
- post-deployment
tasks:
- name: Check pacemaker service is running
become: True
command: "/usr/bin/systemctl show pacemaker --property ActiveState"
register: check_service
changed_when: False
ignore_errors: True
- when: "check_service.stdout == 'ActiveState=active'"
block:
- name: Get pacemaker status
become: true
command: pcs status xml
register: pcs_status
changed_when: False
- name: Check pacemaker status
pacemaker: status="{{ pcs_status.stdout }}"