- become: true block: - command: crm_node -n name: Getting Nova compute hostname register: nova_compute_hostname - fail: msg: Cannot delegate pacemaker cleanup to the bootstrap node. Please delete the resources manually. ignore_errors: true name: Check if pacemaker_short_bootstrap_node_name is a defined variable when: pacemaker_short_bootstrap_node_name is not defined - block: - command: stonith_admin -l {{ nova_compute_hostname.stdout }} delegate_to: '{{ pacemaker_short_bootstrap_node_name }}' name: List STONITH resource for the Compute node register: stonith_service_results - command: pcs stonith disable "{{ item }}" delay: 5 delegate_to: '{{ pacemaker_short_bootstrap_node_name }}' failed_when: disable_output.rc != 0 loop: '{{ stonith_service_results.stdout | regex_findall(''^(stonith-fence(?!_compute-fence-nova).*)'', multiline=True)}}' name: Disable the STONITH resources for the Compute node register: disable_output retries: 3 until: disable_output.rc == 0 - command: pcs stonith delete "{{ item }}" delay: 5 delegate_to: '{{ pacemaker_short_bootstrap_node_name }}' failed_when: delete_output.rc != 0 loop: '{{ stonith_service_results.stdout | regex_findall(''^(stonith-fence(?!_compute-fence-nova).*)'', multiline=True)}}' name: Delete the STONITH resources for the Compute node register: delete_output retries: 3 until: delete_output.rc == 0 - command: pcs stonith level clear target {{ nova_compute_hostname.stdout }} delegate_to: '{{ pacemaker_short_bootstrap_node_name }}' name: Clear the stonith level hierarchy for the Compute node target - command: pcs cluster node remove-remote {{ nova_compute_hostname.stdout }} delegate_to: '{{ pacemaker_short_bootstrap_node_name }}' name: Delete Compute node from cluster - command: crm_resource --set-parameter=pcmk_host_list -r stonith-fence_compute-fence-nova -v "{{ pacemaker_remote_short_node_names | reject('search', nova_compute_hostname.stdout) | join(',') }}" delegate_to: '{{ pacemaker_short_bootstrap_node_name }}' name: Remove compute node in pcmk_host_list parameter from stonith-fence_compute-fence-nova name: Clean up Pacemaker remote and STONITH resources for Compute node when: - nova_compute_hostname.stdout in compute_instanceha_short_node_names - pacemaker_short_bootstrap_node_name is defined tags: down when: - step|int == 1 - container_cli == 'podman' - '"pacemaker_remote" in enabled_services|list' - inventory_hostname_short in compute_instanceha_short_node_names