-
Notifications
You must be signed in to change notification settings - Fork 1
/
down-compute-nodes.yaml
54 lines (46 loc) · 1.48 KB
/
down-compute-nodes.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
# Required Python packages:
#
# ansible
# openstackclient
# openstacksdk
- import_playbook: common.yaml
- hosts: all
gather_facts: no
tasks:
- name: 'Remove the Compute servers'
os_server:
name: "{{ item.1 }}-{{ item.0 }}"
state: absent
with_indexed_items: "{{ [os_compute_server_name] * os_compute_nodes_number }}"
- name: 'List the Compute trunks'
command:
cmd: "openstack network trunk list -c Name -f value"
when: os_networking_type == "Kuryr"
register: trunks
- name: 'Remove the Compute trunks'
command:
cmd: "openstack network trunk delete {{ item.1 }}-{{ item.0 }}"
when:
- os_networking_type == "Kuryr"
- (item.1|string + '-' + item.0|string) in trunks.stdout_lines|list
with_indexed_items: "{{ [os_compute_trunk_name] * os_compute_nodes_number }}"
- name: 'Remove the Compute ports'
os_port:
name: "{{ item.1 }}-{{ item.0 }}"
state: absent
with_indexed_items: "{{ [os_port_worker] * os_compute_nodes_number }}"
- name: Call additional-port processing
include_tasks: additional-ports.yaml
vars:
worker_list: []
port_name_list: []
- name: Remove additionalNetworks ports
os_port:
state: absent
name: "{{ item.0 }}-{{ item.1.name }}"
vnic_type: "{{ item.1.type }}"
network: "{{ item.1.uuid }}"
security_groups: "{{ os_sg_worker if item.1.type == 'normal' else omit }}"
with_nested:
- "{{ worker_list }}"
- "{{ port_name_list }}"