-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcleanup.yaml
71 lines (61 loc) · 1.88 KB
/
cleanup.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
---
############
# CLEANUP #
############
#Remove the value from the network attribute
- name: Delete the values associated with the encr_subnet
uri:
url: "{{ URL }}networks/{{ encr_snet }}/"
method: PATCH
HEADER_Content-Type: "application/json"
status_code: 200
body: "{{ lookup('file','value_delete.json') }}"
body_format: json
delegate_to: localhost
- name: Collect the itervalues
action: uri url={{ URL }}itervalues
register: vals
delegate_to: localhost
- name: Delete the itervalues
uri:
url: "{{ URL }}itervalues/{{ item['id'] }}/"
method: DELETE
HEADER_Content-Type: "application/json"
status_code: 204
delegate_to: localhost
with_items: vals['json']
- name: Collect Attributes to be deleted
action: uri url={{ URL }}attributes return_content=yes
register: attr_dict
- name: Delete the attributes
uri:
url: "{{ URL }}attributes/{{ item['id'] }}/"
method: DELETE
HEADER_Content-Type: "application/json"
status_code: 204
delegate_to: localhost
with_items: attr_dict['json']
- name: Delete the network
uri:
url: "{{ URL }}networks/{{ encr_snet }}/"
method: DELETE
HEADER_Content-Type: "application/json"
status_code: 204
delegate_to: localhost
- name: Delete the Iterables
uri:
url: "{{ URL }}iterables/{{ item }}_counter/"
method: DELETE
HEADER_Content-Type: "application/json"
status_code: 204
delegate_to: localhost
with_items:
- vlan
- cryptomap
- name: Delete the site
uri:
url: "{{ URL }}sites/{{ site_id }}/"
method: DELETE
HEADER_Content-Type: "application/json"
status_code: 204
delegate_to: localhost