- block: - delegate_to: '{{ groups[''Undercloud''] | first }}' import_role: name: tripleo_ipa_cleanup name: unregister node from ipa server vars: tripleo_ipa_hosts_to_delete: - '{{ fqdn_canonical }}' tripleo_ipa_keytab: FILE:/etc/novajoin/krb5.keytab tags: down when: step|int == 1 - become: true block: - changed_when: false check_mode: false command: openstack network agent list --column ID --column Host --column Binary --format yaml delegate_to: '{{ groups[''Undercloud''] | first }}' name: Get neutron agents ID register: neutron_agents_result - check_mode: false delegate_to: '{{ groups[''Undercloud''] | first }}' name: Filter only current host set_fact: neutron_agents: '{{ neutron_agents_result.stdout | from_yaml | selectattr(''Host'', ''match'', ansible_facts[''fqdn''] ~ ''.*'') | list }}' - block: - become: true failed_when: ('msg' in stop_containers and 'Could not find the requested service' not in stop_containers.msg) or ('rc' in stop_containers and stop_containers.rc != 0) loop: - tripleo_ovn_controller - tripleo_ovn_metadata_agent name: Stop OVN containers register: stop_containers service: enabled: false name: '{{ item }}' state: stopped - check_mode: false command: openstack network agent delete {{ agent.ID }} delegate_to: '{{ groups[''Undercloud''] | first }}' loop: '{{ neutron_agents }}' loop_control: label: '{{ agent.Host }}/{{ agent.Binary }}' loop_var: agent name: Delete neutron agents name: Deleting OVN agents environment: OS_CLOUD: overcloud tags: down when: - step|int == 1 - container_cli == 'podman' - 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