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] }}"