-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathconfigure.yml
287 lines (247 loc) · 9.91 KB
/
configure.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
---
- name: configure | Initialize lists
set_fact:
scale_ces_disabled_nodes: []
scale_export_ips: ""
scale_server_nodes: ""
scale_service_list: []
scale_ces_nodes: ""
- name: check | Set default daemon nodename
set_fact:
scale_daemon_nodename: "{{ scale_daemon_nodename }}"
when: hostvars[inventory_hostname].scale_daemon_nodename is undefined
- name: check | Set default admin nodename
set_fact:
scale_admin_nodename: "{{ scale_admin_nodename }}"
when: hostvars[inventory_hostname].scale_admin_nodename is undefined
- name: configure | Collect status of cesSharedRoot
command: "{{ scale_command_path }}mmlsconfig cesSharedRoot"
register: scale_ces_status
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
- name: configure | Configuring cesSharedRoot
command: "{{ scale_command_path }}mmchconfig cesSharedRoot={{ scale_protocols.mountpoint }}"
when: "'undefined' in scale_ces_status.stdout"
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
- name: configure | Prepare server nodes string
set_fact:
scale_server_nodes: "{{ scale_server_nodes + ',' + hostvars[item]['scale_daemon_nodename'] | string }}"
with_items:
- "{{ scale_protocol_node_list }}"
- name: configure | Setting server licenses on protocol nodes
command: "{{ scale_command_path }}mmchlicense server --accept -N {{ scale_server_nodes[1:] }}"
delegate_to: "{{ scale_protocol_node_list.0 }}"
async: 120
poll: 5
run_once: true
- name: configure | Collect status of ces nodes
command: "{{ scale_command_path }}mmces node list"
register: scale_ces_enable_status
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
failed_when: false
ignore_errors: true
- name: configure | Collect all nodes on which ces is not enabled
set_fact:
scale_ces_disabled_nodes: "{{ scale_ces_disabled_nodes + [hostvars[item]['scale_daemon_nodename']] }}"
when: not scale_ces_enable_status.stdout_lines is search(hostvars[item]['scale_daemon_nodename'])
with_items:
- "{{ scale_protocol_node_list }}"
- name: configure | Install arping
package:
name: iputils-arping
state: present
when: (ansible_distribution in scale_ubuntu_distribution) and
(inventory_hostname in scale_protocol_node_list)
- name: configure | Check if SMB is running
shell:
cmd: "{{ scale_command_path }}mmces service list|grep SMB"
register: scale_service_status
when: inventory_hostname in scale_protocol_node_list
ignore_errors: true
failed_when: false
run_once: true
- name: configure | Add SMB service to list
set_fact:
scale_service_list: "{{ scale_service_list + [scale_service_status.stderr|regex_search('SMB')] }}"
when: (inventory_hostname in scale_protocol_node_list) and
( scale_service_status.rc > 0 )
run_once: true
- name: configure | Add SMB service to list
set_fact:
scale_service_list: "{{ scale_service_list + ['SMB'] }}"
when: (inventory_hostname in scale_protocol_node_list) and
( scale_service_status.rc == 0 )
run_once: true
- name: configure | Check if NFS is running
shell:
cmd: "{{ scale_command_path }}mmces service list|grep NFS"
register: scale_service_status
when: inventory_hostname in scale_protocol_node_list
ignore_errors: true
failed_when: false
run_once: true
- name: configure | Add NFS service to the list
set_fact:
scale_service_list: "{{ scale_service_list + [scale_service_status.stderr|regex_search('NFS')] }}"
when: (inventory_hostname in scale_protocol_node_list) and
( scale_service_status.rc > 0 )
run_once: true
- name: configure | Add NFS service to the list
set_fact:
scale_service_list: "{{ scale_service_list + ['NFS'] }}"
when: (inventory_hostname in scale_protocol_node_list) and
( scale_service_status.rc == 0 )
run_once: true
- name: configure | Check if OBJ is running
shell:
cmd: "{{ scale_command_path }}mmces service list|grep OBJ"
register: scale_service_status
when: (ansible_fqdn in scale_protocol_node_list) or
(inventory_hostname in scale_protocol_node_list)
ignore_errors: true
failed_when: false
run_once: true
- name: configure | Add OBJ service to the list
set_fact:
scale_service_list: "{{ scale_service_list + [scale_service_status.stderr|regex_search('OBJ')] }}"
when: (ansible_fqdn in scale_protocol_node_list or inventory_hostname in scale_protocol_node_list) and
( scale_service_status.rc > 0 )
run_once: true
- name: configure | Add OBJ service to the list
set_fact:
scale_service_list: "{{ scale_service_list + ['OBJ'] }}"
when: (ansible_fqdn in scale_protocol_node_list or inventory_hostname in scale_protocol_node_list) and
( scale_service_status.rc == 0 )
run_once: true
- name: configure | Check if S3 is running
shell:
cmd: "{{ scale_command_path }}mmces service list|grep S3"
register: scale_service_status
when: inventory_hostname in scale_protocol_node_list
ignore_errors: true
failed_when: false
run_once: true
- name: configure | Add S3 service to the list
set_fact:
scale_service_list: "{{ scale_service_list + [scale_service_status.stderr|regex_search('S3')] }}"
when: (inventory_hostname in scale_protocol_node_list) and
( scale_service_status.rc > 0 )
run_once: true
- name: configure | Add S3 service to the list
set_fact:
scale_service_list: "{{ scale_service_list + ['S3'] }}"
when: (inventory_hostname in scale_protocol_node_list) and
( scale_service_status.rc == 0 )
run_once: true
- import_role:
name: ibm.spectrum_scale.nfs_install
when: scale_ces_disabled_nodes|length > 0 and 'NFS' in scale_service_list
- import_role:
name: ibm.spectrum_scale.smb_install
when: scale_ces_disabled_nodes|length > 0 and 'SMB' in scale_service_list
- import_role:
name: ibm.spectrum_scale.s3_install
when: scale_ces_disabled_nodes|length > 0 and 'S3' in scale_service_list
- name: configure | Prepare ces nodes string
set_fact:
scale_ces_nodes: "{{ scale_ces_nodes + ',' + item|string }}"
with_items:
- "{{ scale_ces_disabled_nodes }}"
when: scale_ces_disabled_nodes|length > 0
run_once: true
- name: configure | Enabling CES
command: "{{ scale_command_path }}mmchnode -N {{ scale_ces_nodes[1:] }} --ces-enable"
async: 180
poll: 5
when: scale_ces_disabled_nodes|length > 0
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
#- name: configure | Collect status of ces nodes
#shell:
# cmd: "{{ scale_command_path }}mmces node list|grep {{ hostvars[item]['scale_daemon_nodename'] }}"
#register: scale_ces_enable_status
#with_items:
# - "{{ scale_protocol_node_list }}"
#delegate_to: "{{ scale_protocol_node_list.0 }}"
#- name: configure | Check CES enabled on all nodes
#assert:
# that:
# - item.rc == 0
# fail_msg: "CES is not enabled on {{ ansible_hostname }} protocol node"
#with_items:
#- "{{ scale_ces_enable_status.results }}"
#delegate_to: "{{ scale_protocol_node_list.0 }}"
- name: configure| Collect status of ces nodes
command: "{{ scale_command_path }}mmces node list"
register: scale_ces_enable_status
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
- name: configure| List status of ces nodes
debug:
var: scale_ces_enable_status.stdout_lines
run_once: true
- name: configure| Check CES enabled on all nodes
assert:
that:
- hostvars[item]['scale_daemon_nodename'] in scale_ces_enable_status.stdout
fail_msg: "CES is not enabled on {{ item }} protocol node"
success_msg: "Successful enabling of CES on protocol node {{ item }}"
with_items:
- "{{ scale_protocol_node_list }}"
delegate_to: scale_protocol_node_list.0
run_once: true
- name: configure | Enable interface mode
shell:
cmd: "{{ scale_command_path }}mmces interface mode interface --force"
when:
- scale_protocols.interface_mode is defined and scale_protocols.interface_mode | bool
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
- name: configure | Add IPv6 interface
shell:
cmd: "{{ scale_command_path }}mmces interface add --nic {{ item }}"
when: scale_protocols.interface is defined and scale_protocols.interface|length > 0
with_items:
- "{{ scale_protocols.interface }}"
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
- block:
- name: configure | Create CES groups
shell:
cmd: "{{ scale_command_path }}mmchnode --ces-group {{ item.group_name }} -N {{ item.node_list|join(',') }}"
with_items:
- "{{ scale_protocols.scale_ces_groups }}"
- name: configure | Assign export ips as pool for CES groups
command: "{{ scale_command_path }}mmces address add --ces-ip {{ item.export_ip_pool|join(',') }} --ces-group {{ item.group_name}}"
when: inventory_hostname in scale_protocol_node_list
delegate_to: "{{ scale_protocol_node_list.0 }}"
with_items:
- "{{ scale_protocols.scale_ces_groups }}"
when: scale_protocols.scale_ces_groups is defined and scale_protocols.scale_ces_groups|length > 0
- block:
- name: configure | Prepare export ips string
set_fact:
scale_export_ips: "{{ scale_export_ips + ',' + item|string }}"
with_items:
- "{{ scale_protocols.export_ip_pool }}"
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
- name: configure | Assign export ips as pool
command: "{{ scale_command_path }}mmces address add --ces-ip {{ scale_export_ips[1:] }}"
when: scale_protocols.scale_ces_groups is not defined
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
when: scale_protocols.scale_ces_groups is not defined
- name: configure | Rebalance CES IPs
command: "{{ scale_command_path }}mmces address move --rebalance"
#when: inventory_hostname in scale_protocol_node_list
delegate_to: "{{ scale_protocol_node_list.0 }}"
run_once: true
- name: configure | Check if zimon sensor is configured
shell: "/usr/lpp/mmfs/bin/mmperfmon config show"
register: scale_zimon_conf_sensors
delegate_to: "{{ scale_protocol_node_list.0 }}"
failed_when: false
changed_when: false