-
Notifications
You must be signed in to change notification settings - Fork 2
/
dynamic_pool_patching.yml
77 lines (69 loc) · 1.75 KB
/
dynamic_pool_patching.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
---
- hosts: all
gather_facts: no
connection: local
vars:
pool_path: "/Common/{{ poolserver }}"
lb_server: "192.168.1.89"
poolserver: "webservers"
tasks:
- name: Collect BIG-IP facts
bigip_facts:
server: "{{ lb_server }}"
server_port: "443"
# user: admin
# password: admin
include: "pool"
filter: "{{ poolserver }}"
validate_certs: no
register: "poolmembers"
- name: set member facts
set_fact:
members: "{{ ansible_facts.pool[pool_path].member }}"
- name: add hosts from member addresses
add_host:
name: "{{item.address | regex_replace('/Common/(.+)', '\\1')}}"
groups: "webservers"
loop: "{{members}}"
- hosts: webservers
gather_facts: no
serial: 1
vars:
pool_path: "/Common/{{ poolserver }}"
tasks:
- name: Collect BIG-IP facts
bigip_facts:
server: "{{ lb_server }}"
server_port: "443"
# user: admin
# password: admin
include: "pool"
filter: "{{ poolserver }}"
validate_certs: no
delegate_to: localhost
register: "poolmembers"
- name: Disable node pool member
bigip_node:
server: "{{ lb_server }}"
# user: admin
# password: admin
state: "disabled"
name: "{{ inventory_hostname }}"
validate_certs: no
delegate_to: localhost
failed_when: ansible_facts.pool[pool_path].active_member_count <= 1
- name: Patch the system
yum:
name: yum
state: latest
delegate_to: "{{ inventory_hostname }}"
ignore_errors: yes
- name: Enable node pool member
bigip_node:
server: "{{ lb_server }}"
# user: admin
# password: admin
state: "enabled"
name: "{{ inventory_hostname }}"
validate_certs: no
delegate_to: localhost