-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunconfigure_cloud.yml
127 lines (116 loc) · 4.55 KB
/
unconfigure_cloud.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
---
- name: "Unconfigure vCenter Cloud"
hosts: "localhost"
connection: "local"
vars_files:
- '{{ "site_" + deployment_site + ".yml" }}'
tasks:
- name: "Discover Service Engines"
vmware.alb.avi_api_session:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
http_method: "get"
path: '{{ "serviceengine/?cloud_ref.name=" + cloud_parameters.name }}'
register: serviceengines
- name: "Delete Service Engines"
vmware.alb.avi_api_session:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
http_method: "delete"
path: '{{ "serviceengine/" + item.uuid }}'
loop: "{{ serviceengines.obj.results }}"
- name: "Revert cloud to No Access"
vmware.alb.avi_cloud:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
name: "{{ cloud_parameters.name }}"
vtype: CLOUD_NONE
- name: "Delete Avi IPAM Provider"
vmware.alb.avi_ipamdnsproviderprofile:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
name: '{{ "VMware-IPAM-" + cloud_parameters.name }}'
type: "IPAMDNS_TYPE_INTERNAL"
state: absent
- name: "Delete Avi DNS Provider"
vmware.alb.avi_ipamdnsproviderprofile:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
name: '{{ "VMware-DNS-" + cloud_parameters.name }}'
type: "IPAMDNS_TYPE_INTERNAL_DNS"
state: absent
- name: "Remove management default route"
vmware.alb.avi_vrfcontext:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
name: "management"
cloud_ref: '{{ "/api/cloud/?name=" + cloud_parameters.name }}'
static_routes: []
- name: "Discover remaining configured networks"
vmware.alb.avi_api_session:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
http_method: "get"
path: '{{ "network/?cloud_ref.name=" + cloud_parameters.name }}'
register: networks
- name: "Delete configured networks"
vmware.alb.avi_api_session:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
http_method: "delete"
path: '{{ "network/" + item.uuid }}'
loop: "{{ networks.obj.results }}"
- name: "Revert default SE Group"
vmware.alb.avi_serviceenginegroup:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
name: "Default-Group"
cloud_ref: '{{ "/api/cloud/?name=" + cloud_parameters.name }}'
active_standby: false
aggressive_failure_detection: false
algo: "PLACEMENT_ALGO_PACKED"
auto_rebalance: false
auto_redistribute_active_standby_load: false
buffer_se: 1
cpu_reserve: false
cpu_socket_affinity: false
dedicated_dispatcher_core: false
disk_per_se: 10
distribute_load_active_standby: false
ha_mode: "HA_MODE_SHARED"
hm_on_standby: true
license_type: "LIC_CORES"
max_scaleout_per_vs: 4
max_se: 10
max_vs_per_se: 10
memory_per_se: 2048
min_scaleout_per_vs: 1
min_se: 1
per_app: false
placement_mode: "PLACEMENT_MODE_AUTO"
se_bandwidth_type: "SE_BANDWIDTH_UNLIMITED"
se_deprovision_delay: 120
se_name_prefix: "Avi"
vcenter_datastore_mode: "VCENTER_DATASTORE_ANY"
vcenter_datastores_include: false
vcenter_folder: "AviSeFolder"
vcpus_per_se: 1
when: item.name == "Default-Group"
loop: "{{ seg_config }}"
- name: "Delete non-default SE Groups"
vmware.alb.avi_serviceenginegroup:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
name: "{{ item.name }}"
cloud_ref: '{{ "/api/cloud/?name=" + cloud_parameters.name }}'
state: absent
when: item.name != "Default-Group"
loop: "{{ seg_config }}"
- name: "Delete cloud"
vmware.alb.avi_cloud:
avi_credentials: "{{ avi_credentials }}"
api_context: "{{ avi_api_context | default(omit) }}"
name: "{{ cloud_parameters.name }}"
vtype: "CLOUD_NONE"
state: absent
when: cloud_parameters.name != "Default-Cloud"