forked from mlowcher61/F5-Ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_HA.yml
186 lines (169 loc) · 5 KB
/
create_HA.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
---
- name: Set up a BIG-IP HA pair
hosts: localhost
gather_facts: false
vars:
bigip1_ip: 10.0.0.180
bigip2_ip: 10.0.0.181
bigip1_old_name: bigip1
bigip1_new_name: f5-bigip1.home.com
bigip2_old_name: bigip1
bigip2_new_name: f5-bigip2.home.com
bigip1_selfip: 1.1.1.4
bigip2_selfip: 1.1.1.5
ha_vlan: HA_vlan
setup_user: admin
setup_pass: admin
tasks:
- name: Configure SELF-IP for HA on the BIG-IP1
bigip_selfip:
server: "{{ bigip1_ip }}"
user: "{{ setup_user }}"
password: "{{ setup_pass }}"
validate_certs: False
name: "Selfip1_HA"
address: "{{ bigip1_selfip }}"
netmask: "255.255.255.0"
vlan: "{{ ha_vlan }}"
traffic_group: "traffic-group-local-only"
delegate_to: localhost
- name: Configure SELF-IP for HA on the BIG-IP2
bigip_selfip:
server: "{{ bigip2_ip }}"
user: "{{ setup_user }}"
password: "{{ setup_pass }}"
validate_certs: False
name: "Selfip2_HA"
address: "{{ bigip2_selfip }}"
netmask: "255.255.255.0"
vlan: "{{ ha_vlan }}"
traffic_group: "traffic-group-local-only"
delegate_to: localhost
- name: Change device name of BIG-IP1
bigip_command:
server: "{{ bigip1_ip }}"
user: "admin"
password: "admin"
commands:
- mv cm device {{ bigip1_old_name }} {{ bigip1_new_name }}
delegate_to: localhost
- name: Change device name of BIG-IP2
bigip_command:
server: "{{ bigip2_ip }}"
user: "admin"
password: "admin"
commands:
- mv cm device {{ bigip2_old_name }} {{ bigip2_new_name }}
delegate_to: localhost
# - name: Create external vlan
# bigip_vlan
# name: "external"
# user: "{{ setup_user }}"
# password: "{{ setup_pass }}"
# server: "{{ item.server }}"
# validate_certs: False
# delegate_to: localhost
# with_items:
# - server
# "{{ bigip1_ip }}"
# "{{ bigip2_ip }}"
# - name: Create internal vlan
# bigip_vlan
# name: "internal"
# user: "{{ setup_user }}"
# password: "{{ setup_pass }}"
# server: "{{ item.server }}"
# validate_certs: False
# delegate_to: localhost
# with_items:
# - server
# "{{ bigip1_ip }}"
# "{{ bigip2_ip }}"
- name: Set config sync address on BIG-IP1
bigip_command:
server: "{{ bigip1_ip }}"
user: "admin"
password: "admin"
commands:
- modify cm device {{ bigip1_new_name }} configsync-ip {{ bigip1_selfip }}
delegate_to: localhost
- name: Set config sync address on BIG-IP2
bigip_command:
server: "{{ bigip2_ip }}"
user: "admin"
password: "admin"
commands:
- modify cm device {{ bigip2_new_name }} configsync-ip {{ bigip2_selfip }}
delegate_to: localhost
- name: Set unicast address on BIG-IP1
bigip_command:
server: "{{ bigip1_ip }}"
user: "admin"
password: "admin"
commands:
- modify cm device {{ bigip1_new_name }} unicast-address { { ip {{ bigip1_selfip }} } { ip {{ bigip1_ip }} } }
delegate_to: localhost
- name: Set unicast address on BIG-IP2
bigip_command:
server: "{{ bigip2_ip }}"
user: "admin"
password: "admin"
commands:
- modify cm device {{ bigip2_new_name }} unicast-address { { ip {{ bigip2_selfip }} } { ip {{ bigip2_ip }} } }
delegate_to: localhost
- name: Discover device for trust on BIG-IP1
bigip_command:
server: "{{ bigip1_ip }}"
user: "admin"
password: "admin"
commands:
- modify cm trust-domain Root ca-devices add { {{ bigip2_ip }} } name {{ bigip2_new_name }} username admin password admin
delegate_to: localhost
- name: Check sync and failover status of BIG-IP1
bigip_command:
server: "{{ bigip1_ip }}"
user: "admin"
password: "admin"
commands:
- show cm sync-status
wait_for:
- result[0] contains "green"
match: all
delegate_to: localhost
- name: Check sync and failover status of BIG-IP2
bigip_command:
server: "{{ bigip2_ip }}"
user: "admin"
password: "admin"
commands:
- show cm sync-status
wait_for:
- result[0] contains "green"
match: all
delegate_to: localhost
- name: Create device group of type sync-failover
bigip_command:
server: "{{ bigip1_ip }}"
user: "admin"
password: "admin"
commands:
- create cm device-group DG devices add { {{ bigip1_new_name }} {{ bigip2_new_name }} } type sync-failover network-failover enabled
delegate_to: localhost
- name: Perform initial sync of device-group
bigip_command:
server: "{{ bigip1_ip }}"
user: "admin"
password: "admin"
commands:
- run cm config-sync to-group DG
delegate_to: localhost
- name: Confirm HA pair if formed
bigip_command:
server: "{{ bigip1_ip }}"
user: "admin"
password: "admin"
commands:
- show cm sync-status
wait_for:
- result[0] contains "high-availability"
delegate_to: localhost