From 21510c1d2e72d7679d3d417df96bac283464fe5b Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Fri, 11 May 2018 18:31:26 +0200 Subject: [PATCH] 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 --- roles/instance-ha/tasks/main.yml | 5 +++++ roles/instance-ha/tasks/pre-checks.yml | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 roles/instance-ha/tasks/pre-checks.yml diff --git a/roles/instance-ha/tasks/main.yml b/roles/instance-ha/tasks/main.yml index 45e9a0e..cc8694c 100644 --- a/roles/instance-ha/tasks/main.yml +++ b/roles/instance-ha/tasks/main.yml @@ -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 diff --git a/roles/instance-ha/tasks/pre-checks.yml b/roles/instance-ha/tasks/pre-checks.yml new file mode 100644 index 0000000..1111097 --- /dev/null +++ b/roles/instance-ha/tasks/pre-checks.yml @@ -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] }}"