forked from siamaksade/openshift-jenkins-demo
-
Notifications
You must be signed in to change notification settings - Fork 3
/
f5_nodepool_vs_uninstall.yml
81 lines (75 loc) · 2.31 KB
/
f5_nodepool_vs_uninstall.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
---
- name: F5 Virtual Server Remove
hosts: localhost
connection: local
gather_facts: false
become: false
tasks:
- name: Gather ec2 facts
ec2_instance_facts:
region: "{{ ec2_region }}"
filters:
instance-state-name: ["running","shutting-down", "stopping", "stopped"]
register: ec2
tags:
- ec2_facts
- name: Create Facts for F5 configuration
set_fact:
f5_public_ip: "{{ item['public_ip_address'] }}"
f5_private_ip: "{{ item['private_ip_address'] }}"
cacheable: true
when: (item.tags.function == ec2_f5_tag)
loop: "{{ ec2.instances }}"
tags:
- f5_facts
- name: Delete {{ f5_vs_name }} VS
bigip_virtual_server:
name: "{{ f5_vs_name }}"
state: absent
provider:
user: "{{ f5_user }}"
password: "{{ f5_password }}"
server: "{{ f5_public_ip }}"
server_port: 8443
validate_certs: "{{ f5_validate_certs }}"
transport: rest
- name: Delete Pool Members
bigip_pool_member:
pool: "{{ f5_pool_name }}"
port: 80
host: "{{ item['private_ip_address'] }}"
preserve_node: yes
state: absent
provider:
user: "{{ f5_user }}"
password: "{{ f5_password }}"
server: "{{ f5_public_ip }}"
server_port: 8443
validate_certs: "{{ f5_validate_certs }}"
transport: rest
when: (item.tags.function == ec2_webserver_tag)
loop: "{{ ec2.instances }}"
- name: Delete {{ f5_pool_name }} pool
bigip_pool:
name: "{{ f5_pool_name }}"
state: absent
provider:
user: "{{ f5_user }}"
password: "{{ f5_password }}"
server: "{{ f5_public_ip }}"
server_port: 8443
validate_certs: "{{ f5_validate_certs }}"
transport: rest
- name: Delete F5 nodes
bigip_node:
name: "{{ item['private_ip_address'] }}"
state: absent
provider:
user: "{{ f5_user }}"
password: "{{ f5_password }}"
server: "{{ f5_public_ip }}"
server_port: 8443
validate_certs: "{{ f5_validate_certs }}"
transport: rest
when: (item.tags.function == ec2_webserver_tag)
loop: "{{ ec2.instances }}"