-
Notifications
You must be signed in to change notification settings - Fork 8
/
mapr_install.yml
482 lines (410 loc) · 16.7 KB
/
mapr_install.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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
- hosts: all
become: yes
become_user: root
max_fail_percentage: 0
tags: preinstall
roles:
- { role: vicenteg.mapr_accounts }
- { role: oracle_java,
environment: '{{proxy_env}}',
when: use_openjdk is not defined or use_openjdk == False,
java_version: 8,
java_subversion: 102 }
- { role: vicenteg.mapr_redhat_prereqs, when: ansible_os_family == 'RedHat' }
- { role: vicenteg.redhat_timezone, when: ansible_os_family == 'RedHat' }
- { role: vicenteg.mapr_debian_prereqs, when: ansible_os_family == 'Debian' }
- { role: vicenteg.ntp }
- { role: vicenteg.python_lxml }
- { role: vicenteg.mapr_external_packages }
environment: '{{proxy_env}}'
- hosts: all
max_fail_percentage: 0
tags: validation
roles:
- { role: validation_prereqs }
- { role: pre_install_validation }
environment: '{{proxy_env}}'
- hosts: zookeeper
max_fail_percentage: 0
roles:
- vicenteg.mapr_zookeeper
environment: '{{proxy_env}}'
- hosts: cldb
max_fail_percentage: 0
roles:
- vicenteg.mapr_cldb
environment: '{{proxy_env}}'
- hosts: resourcemanager
tags: mapr-core
max_fail_percentage: 0
roles:
- { role: vicenteg.mapr_resourcemanager, when: yarn_enabled is defined and yarn_enabled == True and myriad_enabled != True }
environment: '{{proxy_env}}'
- hosts: historyserver
tags: mapr-core
max_fail_percentage: 0
roles:
- { role: vicenteg.mapr_historyserver, when: yarn_enabled is defined and yarn_enabled == True and myriad_enabled != True }
environment: '{{proxy_env}}'
- hosts: nodemanager
tags: mapr-core
max_fail_percentage: 0
roles:
- { role: vicenteg.mapr_nodemanager, when: yarn_enabled is defined and yarn_enabled == True and myriad_enabled != True }
environment: '{{proxy_env}}'
- hosts: webserver
tags: mapr-core
roles:
- vicenteg.mapr_webserver
environment: '{{proxy_env}}'
- hosts: fileserver
tags: mapr-core
roles:
- vicenteg.mapr_fileserver
environment: '{{proxy_env}}'
- hosts: cluster
tags: mapr-core
roles:
- { role: vicenteg.mapr_nfs, when: nfs_enabled is defined and nfs_enabled == True }
- { role: vicenteg.mapr_posixclient, when: nfs_enabled is defined and nfs_enabled == False and posix_client_enabled is defined and posix_client_enabled == True }
environment: '{{proxy_env}}'
- hosts: mesos-master
become: yes
become_user: root
max_fail_percentage: 0
roles:
- { role: vicenteg.mapr_mesos_master, when: mesos_enabled is defined and mesos_enabled == True }
- { role: vicenteg.mapr_mesos_dns, when: mesos_enabled is defined and mesos_enabled == True }
environment: '{{proxy_env}}'
- hosts: mesos-agent
become: yes
become_user: root
max_fail_percentage: 0
roles:
- { role: vicenteg.mapr_mesos_slave, when: mesos_enabled is defined and mesos_enabled == True }
- { role: vicenteg.mapr_myriad, when: mesos_enabled is defined and mesos_enabled == True and myriad_enabled == True }
environment: '{{proxy_env}}'
- hosts: cluster
become: yes
become_user: root
roles:
- { role: vicenteg.mapr_hbasemaster, when: hbase_enabled }
- { role: vicenteg.mapr_hbaseregionserver, when: hbase_enabled }
environment: '{{proxy_env}}'
- hosts: elasticsearch
become: yes
become_user: root
tasks:
- name: install mapr-elasticsearch
yum: name=mapr-elasticsearch state=present
when: mapr_version|replace("v", "")|version_compare("5.2.0", ">=")
environment: '{{proxy_env}}'
- hosts: opentsdb
become: yes
become_user: root
tasks:
- name: install gnuplot
yum: name=gnuplot state=present
- name: install mapr-opentsdb
yum: name=mapr-opentsdb state=present
when: mapr_version|replace("v", "")|version_compare("5.2.0", ">=")
- name: install mapr-grafana
yum: name=mapr-grafana state=present
when: mapr_version|replace("v", "")|version_compare("5.2.0", ">=")
environment: '{{proxy_env}}'
- hosts: cluster
become: yes
become_user: root
tasks:
- name: install mapr-fluentd
yum: name=mapr-fluentd state=present
when: mapr_version|replace("v", "")|version_compare("5.2.0", ">=")
- name: install mapr-collectd
yum: name=mapr-collectd state=present
when: mapr_version|replace("v", "")|version_compare("5.2.0", ">=")
environment: '{{proxy_env}}'
- hosts: edge
tags: mapr-core
roles:
- { role: vicenteg.mapr_client }
environment: '{{proxy_env}}'
- hosts: edge
tags: mapr-core
environment: '{{proxy_env}}'
tasks:
- name: check for maprpatch repo
command: yum repolist maprpatch
failed_when: false
register: maprpatch_exists
- name: check for mapr-patch package
command: yum list mapr-patch
failed_when: yum_list_mapr_patch.rc not in (0,1)
changed_when: false
register: yum_list_mapr_patch
when: maprpatch_exists.rc == 0
- name: install mapr-patch
become: yes
become_user: root
yum: name=mapr-patch-client state=present
environment: '{{proxy_env}}'
when: maprpatch_exists.rc == 0 and yum_list_mapr_patch.rc == 0
- hosts: cluster
tags: mapr-core
environment: '{{proxy_env}}'
tasks:
- name: check for maprpatch repo
command: yum repolist maprpatch
failed_when: false
register: maprpatch_exists
- name: check for mapr-patch package
command: yum list mapr-patch
failed_when: yum_list_mapr_patch.rc not in (0,1)
changed_when: false
register: yum_list_mapr_patch
when: maprpatch_exists.rc == 0
- name: install mapr-patch
become: yes
become_user: root
yum: name=mapr-patch state=present
environment: '{{proxy_env}}'
when: maprpatch_exists.rc == 0 and yum_list_mapr_patch.rc == 0
- hosts: cluster
tags: mapr-core
environment: '{{proxy_env}}'
tasks:
- name: find hadoop version
shell: rpm -qa --queryformat '%{VERSION} %{RELEASE}' mapr-hadoop-core | awk '{ print substr($0,0,5) }'
register: hadoop_version
changed_when: false
- name: configure proxyuser groups
hadoop_properties:
create: True
file: /opt/mapr/hadoop/hadoop-{{hadoop_version.stdout}}/etc/hadoop/core-site.xml
name: hadoop.proxyuser.mapr.groups
value: "*"
become: yes
become_user: root
# when: secure_cluster is defined and secure_cluster == True
- name: configure proxyuser hosts
hadoop_properties:
create: True
file: /opt/mapr/hadoop/hadoop-{{hadoop_version.stdout}}/etc/hadoop/core-site.xml
name: hadoop.proxyuser.mapr.hosts
value: "*"
become: yes
become_user: root
# when: secure_cluster is defined and secure_cluster == True
- hosts: all
tags: mapr-core
roles:
- { role: vicenteg.mapr_configuration, tags: configuration, java_home: /usr/java/default }
- hosts: zookeeper
tags: mapr-core
roles:
- { role: vicenteg.mapr_zookeeper_startup }
- hosts: cluster
tags: mapr-core
tasks:
- name: tune MFS memory if memory is low
become: yes
become_user: root
lineinfile: dest=/opt/mapr/conf/warden.conf regexp=service.command.mfs.heapsize.percent line=service.command.mfs.heapsize.percent=20 backup=yes
when: ansible_memtotal_mb < 16384
- name: tune MFS memory if memory is low
become: yes
become_user: root
lineinfile: dest=/opt/mapr/conf/warden.conf regexp=service.command.mfs.heapsize.maxpercent line=service.command.mfs.heapsize.maxpercent=65 backup=yes
when: ansible_memtotal_mb < 16384
- hosts: cluster
tags: mapr-core
tasks:
- name: do not use disks for YARN if disk count is low
become: yes
become_user: root
hadoop_properties: file=/opt/mapr/hadoop/hadoop-{{hadoop_version.stdout}}/etc/hadoop/mapred-site.xml name=mapreduce.{{item}}.disk value=0
with_items:
- map
- reduce
when: mapr_disks|length < 4
- hosts: cldb
tags: mapr-core
roles:
- { role: vicenteg.mapr_cldb_startup }
- hosts: cldb[0]
become: yes
become_user: mapr
tags: mapr-core
roles:
- { role: vicenteg.mapr_maprlogin, when: secure_cluster is defined and secure_cluster == True }
tasks:
- name: set default desired replication to 1
command: maprcli config save -values "{cldb.volumes.default.replication:1}"
when: groups['cluster'] | length == 1
- name: set default min replication to 1
command: maprcli config save -values "{cldb.volumes.default.min.replication:1}"
when: groups['cluster'] | length == 1
- name: set replication to 1 if single node
shell: maprcli volume list -columns volumename | grep -v volumename | awk '{print $1}' | xargs -n1 -I'{}' maprcli volume modify -name '{}' -replication 1 -minreplication 1
when: groups['cluster'] | length == 1
- hosts: cluster
tags: mapr-core
roles:
- { role: vicenteg.mapr_cluster_startup }
- hosts: cluster
become: yes
become_user: root
tasks:
- name: obtain a MapR ticket for root using {{maprlogin_username}} (required to create opentsdb table)
shell: echo {{maprlogin_pw_clear}} | maprlogin password -user {{maprlogin_username}}
no_log: true
when: secure_cluster and opentsdb_enabled is defined and opentsdb_enabled
- name: configure MapR Monitoring
command: /opt/mapr/server/configure.sh -R {% if opentsdb_enabled and groups['opentsdb']|length > 0 %}-OT {% for node in groups['opentsdb'] %}{{ hostvars[node].ansible_fqdn }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %} {% if elasticsearch_enabled is defined and elasticsearch_enabled and groups['elasticsearch']|length > 0 %} -ES {% for node in groups['elasticsearch'] %}{{ hostvars[node].ansible_fqdn }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %}
when: opentsdb_enabled is defined and opentsdb_enabled
- hosts: cluster
tags: mapr-core
roles:
- { role: vicenteg.mapr_license, when: license_file is defined and license_file != '' }
- hosts: mesos-master
roles:
- { role: vicenteg.mapr_myriad_startup, when: myriad_enabled }
- hosts: hiveserver
roles:
- { role: vicenteg.mapr_hive, when: classic_enabled or yarn_enabled and hive_enabled is defined and hive_enabled == True }
environment: '{{proxy_env}}'
- hosts: cluster
roles:
- { role: vicenteg.mapr_pig, when: classic_enabled or yarn_enabled and pig_enabled is defined and pig_enabled == True }
environment: '{{proxy_env}}'
- hosts: hue
roles:
- { role: vicenteg.mapr_httpfs, when: httpfs_enabled is defined and httpfs_enabled == True }
environment: '{{proxy_env}}'
- hosts: cluster
roles:
- { role: vicenteg.mapr_solr, when: solr_enabled }
environment: '{{proxy_env}}'
- hosts: oozie
roles:
- { role: vicenteg.mapr_oozie, when: classic_enabled or yarn_enabled and oozie_enabled is defined and oozie_enabled == True }
environment: '{{proxy_env}}'
- hosts: hue
roles:
- { role: vicenteg.mapr-hue, when: hue_enabled is defined and hue_enabled == True }
environment: '{{proxy_env}}'
- hosts: drill
roles:
- { role: vicenteg.mapr_drill, tags: [ "drill" ], when: drill_enabled is defined and drill_enabled == True }
environment: '{{proxy_env}}'
- hosts: drill
tasks:
- name: log in to drillbit
command: curl -c .drillbit_cookies -k -f -X POST -d j_username={{mapr_admin_username|default("mapr")}} -d j_password={{maprlogin_clear_pw|default("mapr")}} https://{{hostvars[inventory_hostname].ansible_fqdn}}:8047/j_security_check
run_once: true
when: drill_enabled is defined and drill_enabled and hive_enabled and secure_cluster is defined and secure_cluster == True
- name: add hive storage plugin (SSL)
command: 'curl -b .drillbit_cookies -k -f -H "Content-Type: application/json" -X POST -d @/tmp/hive-storage-plugin.json https://{{hostvars[inventory_hostname].ansible_fqdn}}:8047/storage/hive.json'
run_once: true
when: drill_enabled is defined and drill_enabled and hive_enabled is defined and hive_enabled == True and secure_cluster is defined and secure_cluster == True
- name: add hive storage plugin (no SSL)
shell: 'curl -f -H "Content-Type: application/json" -X POST -d @/tmp/hive-storage-plugin.json http://{{hostvars[inventory_hostname].ansible_fqdn}}:8047/storage/hive.json'
run_once: true
when: drill_enabled is defined and drill_enabled and hive_enabled is defined and hive_enabled == True and (secure_cluster is not defined or secure_cluster == False)
- hosts: spark_master
become: yes
roles:
- { role: vicenteg.mapr_spark_master, when: spark_enabled is defined and spark_enabled and yarn_enabled is defined and yarn_enabled == False }
environment: '{{proxy_env}}'
- hosts: spark_slave
become: yes
become_user: root
roles:
- { role: vicenteg.mapr_spark_slave, when: spark_enabled is defined and spark_enabled }
environment: '{{proxy_env}}'
- hosts: spark_slave
tasks:
- name: create /apps volume for Spark
run_once: yes
become: yes
become_user: '{{mapr_admin_username}}'
mapr_volume: name=apps.spark path=/apps/spark state=present username={{mapr_admin_username}} password={{mapr_password_clear|default("mapr")}} mapr_webserver={{mapr_webserver}}
when: spark_enabled is defined and spark_enabled
- name: create a spark work directory
become: yes
become_user: root
file: dest=/opt/mapr/spark/tmp owner={{mapr_admin_username}} group={{mapr_admin_username}} state=directory mode=0750
when: spark_enabled is defined and spark_enabled
- name: create a local volume for spark work directory
mapr_volume:
args:
name: mapr.{{ansible_fqdn}}.local.spark
path: /var/mapr/local/{{ansible_fqdn}}/spark
createparent: true
replication: "1"
minreplication: "1"
localvolumehost: '{{ansible_fqdn}}'
mapr_webserver: '{{mapr_webserver}}'
state: present
when: spark_enabled is defined and spark_enabled
- name: set spark work directory in spark configuration
become: yes
become_user: '{{mapr_admin_username}}'
lineinfile: dest=/opt/mapr/spark/spark-{{spark_version}}/conf/spark-env.sh state=present regexp="^export SPARK_WORKER_DIR" line="export SPARK_WORKER_DIR=/mapr/{{cluster_name}}/var/mapr/local/{{ansible_fqdn}}/spark"
when: spark_enabled is defined and spark_enabled
- hosts: kafka
roles:
- { role: vicenteg.mapr-kafka, when: kafka_enabled is defined and kafka_enabled == True }
environment: '{{proxy_env}}'
- hosts: edge
roles:
- { role: vicenteg.mapr_maprlogin, when: secure_cluster is defined and secure_cluster == True }
- { role: vicenteg.mapr_loopbacknfs, when: loopbacknfs_enabled is defined and loopbacknfs_enabled }
- { role: vicenteg.mapr_posixclient, when: posix_client_enabled is defined and posix_client_enabled }
tasks:
- name: restart posix client
become: yes
become_user: root
service: name=mapr-posix-client-{{posix_client_edition|default("basic")}} state=restarted
- hosts: all
tasks:
- name: test whether dhclient is running
command: pgrep -f dhclient
register: dhclient_running
- name: configure dhclient if node uses DHCP
become: yes
become_user: root
lineinfile: >
line="interface \"{{ansible_default_ipv4.interface}}\" { prepend domain-name-servers {% for h in groups['mesos-master'] %}{{hostvars[h].ansible_default_ipv4.address}}{% if not loop.last %},{% endif %}{% endfor %}; }"
dest=/etc/dhcp/dhclient.conf
regexp='domain-name-servers'
when: dhclient_running.rc == 0 and myriad_enabled is defined and myriad_enabled
- name: configure resolv.conf if not using DHCP
become: yes
become_user: root
lineinfile: >
line="nameserver {{hostvars[item].ansible_default_ipv4.address}}"
#line="nameserver {{hostvars[groups['mesos-master'][0]].ansible_default_ipv4.address}}"
dest=/etc/resolv.conf
insertafter="^search"
with_items: '{{groups["mesos-master"]}}'
when: dhclient_running.rc != 0 and myriad_enabled is defined and myriad_enabled
environment: '{{proxy_env}}'
- name: restart network
become: yes
become_user: root
service: name=network state=restarted
when: myriad_enabled is defined and myriad_enabled
- hosts: hiveserver
roles:
- { role: vicenteg.mapr_hive_test, tags: [ "test" ], when: classic_enabled or yarn_enabled and hive_enabled is defined and hive_enabled == True }
environment: '{{proxy_env}}'
- hosts: cluster
roles:
- { role: vicenteg.mapr_drill_test, tags: [ "test" ], when: drill_enabled is defined and drill_enabled == True }
- { role: vicenteg.mapr_spark_test, tags: [ "test" ], when: spark_enabled is defined and spark_enabled and skip_tests == False }
environment: '{{proxy_env}}'
- hosts: edge:cluster
become: yes
become_user: mapr
roles:
- { role: vicenteg.mapr_post_install_test, tags: [ "test" ], when: skip_tests is defined and skip_tests == False }