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>
This commit is contained in:
Gael Chamoulaud 2018-11-27 17:40:10 +01:00
parent b9eedacdb6
commit 216788c320

View File

@ -12,10 +12,19 @@
groups: groups:
- post-deployment - post-deployment
tasks: tasks:
- name: Get pacemaker status - name: Check pacemaker service is running
become: true become: True
command: pcs status xml command: "/usr/bin/systemctl show pacemaker --property ActiveState"
register: pcs_status register: check_service
changed_when: False changed_when: False
- name: Check pacemaker status ignore_errors: True
pacemaker: status="{{ pcs_status.stdout }}"
- 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 }}"