forked from openshift/installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdown-network.yaml
69 lines (56 loc) · 1.98 KB
/
down-network.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Required Python packages:
#
# ansible
# openstackclient
# openstacksdk
- import_playbook: common.yaml
- hosts: all
gather_facts: no
tasks:
- name: 'List ports attatched to router'
command:
cmd: "openstack port list --device-owner=network:router_interface --tags {{ cluster_id_tag }} -f value -c id"
register: router_ports
- name: 'Remove the ports from router'
command:
cmd: "openstack router remove port {{ os_router }} {{ item.1}}"
with_indexed_items: "{{ router_ports.stdout_lines }}"
- name: 'List ha ports attached to router'
command:
cmd: "openstack port list --device-owner=network:ha_router_replicated_interface --tags {{ cluster_id_tag }} -f value -c id"
register: ha_router_ports
- name: 'Remove the ha ports from router'
command:
cmd: "openstack router remove port {{ os_router }} {{ item.1}}"
with_indexed_items: "{{ ha_router_ports.stdout_lines }}"
- name: 'List ports'
command:
cmd: "openstack port list --tags {{ cluster_id_tag }} -f value -c id"
register: ports
- name: 'Remove the cluster ports'
command:
cmd: "openstack port delete {{ ports.stdout_lines | join(' ') }}"
when: ports.stdout != ""
- name: 'Remove the cluster router'
os_router:
name: "{{ os_router }}"
state: absent
- name: 'List cluster networks'
command:
cmd: "openstack network list --tags {{ cluster_id_tag }} -f value -c ID"
register: networks
- name: 'Remove the cluster networks'
command:
cmd: "openstack network delete {{ networks.stdout_lines | join(' ') }}"
when: networks.stdout != ""
- name: 'List the cluster subnet pool'
command:
cmd: "openstack subnet pool list --name {{ subnet_pool }}"
when: os_networking_type == "Kuryr"
register: pods_subnet_pool
- name: 'Remove the cluster subnet pool'
command:
cmd: "openstack subnet pool delete {{ subnet_pool }}"
when:
- os_networking_type == "Kuryr"
- pods_subnet_pool.stdout != ""