-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisable-pool-member.yml
More file actions
42 lines (38 loc) · 1.2 KB
/
disable-pool-member.yml
File metadata and controls
42 lines (38 loc) · 1.2 KB
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
---
- name: Disabling a pool member
hosts: lb
connection: local
gather_facts: false
tasks:
- name: Setup provider
set_fact:
provider:
server: "{{ansible_host}}"
user: "{{ansible_user}}"
password: "{{ansible_password}}"
server_port: 8443
validate_certs: false
- name: Discover pool names
f5networks.f5_modules.bigip_device_info:
provider: "{{provider}}"
partition: "student2"
gather_subset:
- ltm-pools
register: bigip_device_facts
# - name: "View complete output"
# debug: "msg={{bigip_device_facts}}"
- name: "Show members belonging to pool"
debug: "msg={{item}}"
loop: "{{bigip_device_facts.ltm_pools | community.general.json_query(query_string)}}"
vars:
query_string: "[?name=='http_pool'].members[*].name[]"
- name: "Disable pool members"
f5networks.f5_modules.bigip_pool_member:
provider: "{{provider}}"
partition: "student2"
state: "disabled"
name: "{{hostvars[item].inventory_hostname}}"
host: "{{hostvars[item].ansible_host}}"
port: "80"
pool: "http_pool"
loop: "{{ groups['web'] }}"