github.com/openshift/installer@v1.4.17/upi/openstack/down-network.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: 'List ports attatched to router' 14 ansible.builtin.command: 15 cmd: "openstack port list --device-owner=network:router_interface --tags {{ cluster_id_tag }} -f value -c id" 16 register: router_ports 17 18 - name: 'Remove the ports from router' 19 ansible.builtin.command: 20 cmd: "openstack router remove port {{ os_router }} {{ item.1}}" 21 with_indexed_items: "{{ router_ports.stdout_lines }}" 22 23 - name: 'List ha ports attached to router' 24 ansible.builtin.command: 25 cmd: "openstack port list --device-owner=network:ha_router_replicated_interface --tags {{ cluster_id_tag }} -f value -c id" 26 register: ha_router_ports 27 28 - name: 'Remove the ha ports from router' 29 ansible.builtin.command: 30 cmd: "openstack router remove port {{ os_router }} {{ item.1}}" 31 with_indexed_items: "{{ ha_router_ports.stdout_lines }}" 32 33 - name: 'List ports' 34 ansible.builtin.command: 35 cmd: "openstack port list --tags {{ cluster_id_tag }} -f value -c id" 36 register: ports 37 38 - name: 'Remove the cluster ports' 39 ansible.builtin.command: 40 cmd: "openstack port delete {{ ports.stdout_lines | join(' ') }}" 41 when: ports.stdout != "" 42 43 - name: 'Remove the cluster router' 44 openstack.cloud.router: 45 name: "{{ os_router }}" 46 state: absent 47 48 - name: 'List cluster networks' 49 ansible.builtin.command: 50 cmd: "openstack network list --tags {{ cluster_id_tag }} -f value -c ID" 51 register: networks 52 53 - name: 'Remove the cluster networks' 54 ansible.builtin.command: 55 cmd: "openstack network delete {{ networks.stdout_lines | join(' ') }}" 56 when: networks.stdout != ""