diff --git a/roles/instance-ha/tasks/apply.yml b/roles/instance-ha/tasks/apply.yml index 8a6b4d1..28c3788 100644 --- a/roles/instance-ha/tasks/apply.yml +++ b/roles/instance-ha/tasks/apply.yml @@ -280,11 +280,6 @@ pcs constraint order start openstack-nova-conductor-clone then nova-compute-checkevacuate-clone require-all=false when: release in [ 'liberty', 'rhos-8', 'mitaka', 'rhos-9' ] - - name: Check if ipmi exists for all compute nodes - shell: | - pcs stonith show ipmilan-{{ hostvars[item]['ansible_hostname'] }} - with_items: "{{ groups['compute'] }}" - - name: Set requires to fencing as default for all resources (Pike/RHOS-12) shell: "pcs resource defaults requires=fencing" when: release in [ 'pike', 'rhos-12' ] @@ -319,8 +314,10 @@ shell: "pcs property set --node {{ hostvars[item]['ansible_hostname'] }} osprole=compute" with_items: "{{ groups['compute'] }}" - - name: Add pacemaker stonith devices of compute nodes to level 1 - shell: "pcs stonith level add 1 {{ hostvars[item]['ansible_hostname'] }} ipmilan-{{ hostvars[item]['ansible_hostname'] }},fence-nova" + - name: Add STONITH level definitions for compute nodes + shell: | + compute_stonith_name=$(cibadmin --query --xpath "//primitive[@class='stonith']/instance_attributes/nvpair[@value='{{ item }}']" | sed 's/.*id="\(.*\)-instance_attributes-pcmk_host_list".*/\1/g') + pcs stonith level add 1 {{ item }} $compute_stonith_name,fence-nova with_items: "{{ groups['compute'] }}" - name: Enable keystone resource diff --git a/roles/instance-ha/tasks/undo.yml b/roles/instance-ha/tasks/undo.yml index 278324b..5ee6187 100644 --- a/roles/instance-ha/tasks/undo.yml +++ b/roles/instance-ha/tasks/undo.yml @@ -1,5 +1,14 @@ --- - block: + - name: Remove STONITH level definitions for compute nodes + shell: | + compute_stonith_name=$(cibadmin --query --xpath "//primitive[@class='stonith']/instance_attributes/nvpair[@value='{{ item }}']" | sed 's/.*id="\(.*\)-instance_attributes-pcmk_host_list".*/\1/g') + for stonith_level in $(cibadmin --query --xpath "//configuration/fencing-topology/fencing-level[@devices='$compute_stonith_name,fence-nova'][@index='1'][@target='{{ item }}']" --node-path) + do + pcs stonith level delete 1 {{ item }} $compute_stonith_name,fence-nova + done + with_items: "{{ groups['compute'] }}" + - name: Remove fence-nova STONITH device shell: | for stonithid in $(pcs stonith show | awk '/fence_compute/ {print $1}')