Add pre checks before installing instance HA

This commit is the first of two that will try to make the instance HA
procedure idempotent. This first one adds pre checks that make the
procedure fail if there are already IHA resources or STONITH resources
inside the cluster.

Change-Id: Ib481f7be119ffd301e53d952c413f1ba0e05de84
This commit is contained in:
Raoul Scarazzini 2018-05-11 18:31:26 +02:00
parent 29ebf802e1
commit 21510c1d2e
2 changed files with 30 additions and 0 deletions

View File

@ -1,4 +1,9 @@
---
- name: Check if Instance HA steps were already applied
include: pre-checks.yml
when:
- instance_ha_action == "install"
- name: Apply STONITH for controller nodes
include_role:
name: stonith-config

View File

@ -0,0 +1,25 @@
---
- block:
- name: Check if STONITH resources already exist
shell: |
pcs stonith show | grep {{ item }}
with_items:
- fence-nova
register: pre_existing_stonith
failed_when: pre_existing_stonith.rc == 0
- name: Check if IHA resources already exist
shell: |
pcs resource show | grep "{{ item }}"
with_items:
- compute-unfence-trigger
- nova-compute-checkevacuate
- nova-compute
- nova-evacuate
- neutron-openvswitch-agent-compute
- libvirtd-compute
- ceilometer-compute
register: pre_existing_resources
failed_when: pre_existing_resources.rc == 0
become: yes
delegate_to: "{{ groups.controller[0] }}"