forked from ismc/clus_brkarc-2023_2016
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdestroy_openstack_vpc.yml
45 lines (38 loc) · 1.01 KB
/
destroy_openstack_vpc.yml
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
---
- hosts: hubs:hosts
gather_facts: no
connection: local
vars_files:
- ./cloud_vars.yml
tasks:
- name: Terminate instances that were previously launched
os_server:
state: absent
name: '{{ id }}'
when: cloud == 'openstack'
- name: Remove instance from the host file
local_action: lineinfile dest=hosts regexp="{{ id }}" state=absent
when: cloud == 'openstack'
- hosts: localhost
connection: local
gather_facts: no
vars_files:
- ./cloud_vars.yml
tasks:
- name: Delete the tenant subnet
os_subnet:
state: absent
name: '{{ cloud_tag }}'
- name: Delete the tenant network
os_network:
state: absent
shared: false
name: '{{ cloud_tag }}'
- name: Delete the Private Key
os_keypair:
state: absent
name: '{{ cloud_tag }}_key'
- name: Delete security group
os_security_group:
state: absent
name: '{{ cloud_tag }}'