github.com/openshift/installer@v1.4.17/upi/openstack/down-control-plane.yaml (about) 1 # Required Python packages: 2 # 3 # ansible 4 # openstackclient 5 # openstacksdk 6 7 - ansible.builtin.import_playbook: common.yaml 8 9 - hosts: all 10 gather_facts: no 11 12 tasks: 13 - name: 'Remove the Control Plane servers' 14 openstack.cloud.server: 15 name: "{{ item.1 }}-{{ item.0 }}" 16 state: absent 17 with_indexed_items: "{{ [os_cp_server_name] * os_cp_nodes_number }}" 18 19 - name: 'List the Server groups' 20 ansible.builtin.command: 21 # os-compute-api-version 2.15 or higher is required for the 'soft-anti-affinity' policy 22 cmd: "openstack --os-compute-api-version=2.15 server group list -f json -c ID -c Name" 23 register: server_group_list 24 25 - name: 'Parse the Server group ID from existing' 26 ansible.builtin.set_fact: 27 server_group_id: "{{ (server_group_list.stdout | from_json | json_query(list_query) | first).ID }}" 28 vars: 29 list_query: "[?Name=='{{ os_cp_server_group_name }}']" 30 when: 31 - "os_cp_server_group_name|string in server_group_list.stdout" 32 33 - name: 'Remove the Control Plane server group' 34 ansible.builtin.command: 35 # os-compute-api-version 2.15 or higher is required for the 'soft-anti-affinity' policy 36 cmd: "openstack --os-compute-api-version=2.15 server group delete {{ server_group_id }}" 37 when: 38 - server_group_id is defined 39 40 - name: 'Remove the Control Plane ports' 41 openstack.cloud.port: 42 name: "{{ item.1 }}-{{ item.0 }}" 43 state: absent 44 with_indexed_items: "{{ [os_port_master] * os_cp_nodes_number }}"