forked from cloudera-labs/cloudera-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster.yml
576 lines (517 loc) · 12.8 KB
/
cluster.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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
---
# Copyright 2021 Cloudera, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This Playbook is specifically for Deploying Cloudera Clusters
# Edit with extreme caution
# This plays are imported from a separate playbook so that Ansible tags are intuitively propagated from main.yml
# STARTBLOCK # Init run
- name: Init Cluster Deployment Tasks
hosts: localhost
tags: always
gather_facts: no
tasks:
# TODO: Move to dependent roles with delegation if necessary
- name: Create local temp directories
file: "{{ __dir }}"
loop:
- path: "{{ local_temp_dir }}/csrs"
state: directory
- path: "{{ local_temp_dir }}/certs"
state: directory
loop_control:
loop_var: __dir
- name: Check Inventory Connectivity
hosts: all
tags: always
gather_facts: no
tasks:
- name: Check connectivity to Inventory
ansible.builtin.wait_for_connection:
- name: Gather facts from connected inventory
setup:
# ENDBLOCK # Init run
# STARTBLOCK # Verify Inventory and Definition
# Moved from tasks/group_hosts and tasks/group_hosts_by_tls
- name: Group hosts using host template information
hosts: all
gather_facts: no
roles:
- cloudera.cluster.deployment.groupby
tags:
- always
- name: Verify inventory [verify_inventory]
hosts: localhost
gather_facts: no
roles:
- cloudera.cluster.verify.inventory
tags:
- verify
- verify_inventory
- default_cluster
- full_cluster
- name: Verify definition [verify_definition]
hosts: cloudera_manager
gather_facts: no
roles:
- cloudera.cluster.verify.definition
tags:
- verify
- verify_definition
- default_cluster
- full_cluster
# Moved before parcel verification to allow rehosting
- name: Install custom parcel repository
hosts: custom_repo
become: yes
roles:
- cloudera.cluster.infrastructure.custom_repo
tags:
- custom_repo
- default_cluster
- full_cluster
# Moved from verify_parcels to reduce duplication
- name: Verify definition [verify_parcels_and_roles]
hosts: cloudera_manager
gather_facts: no
roles:
- cloudera.cluster.verify.parcels_and_roles
tags:
- verify
- verify_parcels
- default_cluster
- full_cluster
# ENDBLOCK # Verify Inventory and Definition
# STARTBLOCK # Prepare Nodes
- name: Apply OS pre-requisite configurations
hosts: cloudera_manager, cluster, ca_server
become: yes
roles:
- cloudera.cluster.prereqs.os
tags:
- os
- default_cluster
- full_cluster
- name: Create local user accounts
hosts: cloudera_manager, cluster, tls
become: yes
gather_facts: no
roles:
- cloudera.cluster.prereqs.user_accounts
tags:
- users
- default_cluster
- full_cluster
- name: Install JDK
hosts: cloudera_manager, cluster, tls
become: yes
roles:
- cloudera.cluster.prereqs.jdk
tags:
- jdk
- default_cluster
- full_cluster
- name: Install MySQL Connector
hosts: cloudera_manager, cluster
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.prereqs.mysql_connector
when: database_type == 'mysql' or database_type == 'mariadb'
tags:
- mysql_connector
- full_cluster
- name: Install Oracle Connector
hosts: cloudera_manager, cluster
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.prereqs.oracle_connector
when: database_type == 'oracle'
tags:
- oracle_connector
- full_cluster
- name: Install PostgreSQL Connector
hosts: cloudera_manager, cluster
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.prereqs.postgresql_connector
when: database_type == 'postgresql'
tags:
- postgresql_connector
- full_cluster
# ENDBLOCK # Prepare Nodes
# STARTBLOCK # Create Cluster Service Infrastructure
- name: Install KDC
hosts: krb5_server
become: yes
roles:
- role: cloudera.cluster.infrastructure.krb5_server
tags:
- security
- kerberos
- tls
- full_cluster
- name: Setup KRB5 clients
hosts: cloudera_manager, cluster
become: yes
roles:
- role: cloudera.cluster.infrastructure.krb5_client
when: "'krb5_server' in groups"
tags:
- security
- kerberos
- tls
- full_cluster
- name: Install CA server
hosts: ca_server
become: yes
roles:
- cloudera.cluster.infrastructure.ca_server
tags:
- security
- tls
- full_cluster
- name: Install HAProxy
hosts: haproxy
become: yes
roles:
- cloudera.cluster.infrastructure.haproxy
tags:
- ha
- full_cluster
# ENDBLOCK # Create Cluster Service Infrastructure
# STARTBLOCK # Prepare TLS
- name: Build TLS keystores and truststores
hosts: tls
become: yes
gather_facts: no
roles:
- cloudera.cluster.security.tls_generate_csr
- cloudera.cluster.security.tls_signing
- cloudera.cluster.security.tls_install_certs
vars:
local_certs_dir: "{{ local_temp_dir }}/certs"
local_csrs_dir: "{{ local_temp_dir }}/csrs"
tags:
- tls
- full_cluster
- name: Delete temp directories
hosts: localhost
become: no
gather_facts: no
tasks:
- file:
path: "{{ [local_temp_dir, dir] | path_join }}"
state: absent
loop:
- csrs
- certs
loop_control:
loop_var: dir
tags:
- always
# ENDBLOCK # Prepare TLS
# STARTBLOCK # Install Cluster Service Infrastructure II
- name: Install RDBMS
hosts: db_server
become: yes
roles:
- cloudera.cluster.infrastructure.rdbms
tags:
- database
- default_cluster
- full_cluster
# ENDBLOCK # Install Cluster Service Infrastructure II
# STARTBLOCK # NiFi TLS
- name: Setup symlinks for NiFi TLS keystore and truststore
hosts: cluster
become: yes
gather_facts: no
roles:
- role: cloudera.cluster.security.tls_nifi
when: >
(tls | default(False)
or manual_tls_cert_distribution | default(False))
and not (autotls | default(False))
# ENDBLOCK # NiFi TLS
# STARTBLOCK # Install Cloudera Manager
- name: Install Cloudera Manager daemons
hosts: cloudera_manager, cluster
become: yes
any_errors_fatal: true
roles:
- role: cloudera.cluster.cloudera_manager.daemons
tags:
- cm
- default_cluster
- full_cluster
- name: Install Cloudera Manager server
hosts: cloudera_manager
become: yes
roles:
- role: cloudera.cluster.cloudera_manager.server
tags:
- cm
- default_cluster
- full_cluster
- name: Install Cloudera Manager License
hosts: cloudera_manager
become: yes
roles:
- role: cloudera.cluster.cloudera_manager.license
tags:
- cm
- license
- default_cluster
- full_cluster
- name: Install Cloudera Manager agents
hosts: cloudera_manager, cluster
become: yes
any_errors_fatal: true
roles:
- role: cloudera.cluster.cloudera_manager.agent
tags:
- cm
- default_cluster
- full_cluster
- name: Configure Cloudera Manager server for TLS
hosts: cloudera_manager
become: yes
gather_facts: no
roles:
- role: cloudera.cluster.cloudera_manager.server_tls
when: tls | default(False) or manual_tls_cert_distribution | default(False)
tags:
- tls
- cm
- full_cluster
- name: Configure Cloudera Manager agents
hosts: cloudera_manager, cluster
become: yes
any_errors_fatal: true
roles:
- cloudera.cluster.cloudera_manager.agent_config
tags:
- cm
- default_cluster
- full_cluster
- name: Configure Cloudera Manager server
hosts: localhost
gather_facts: no
roles:
- cloudera.cluster.cloudera_manager.config
tags:
- cm
- default_cluster
- full_cluster
- name: Configure Cloudera Manager auth and accounts
hosts: cloudera_manager
gather_facts: no
roles:
- role: cloudera.cluster.cloudera_manager.external_auth
- role: cloudera.cluster.cloudera_manager.external_account
tags:
- cm
- full_cluster
- name: Configure Cloudera Manager Password
hosts: cloudera_manager
gather_facts: no
roles:
- role: cloudera.cluster.cloudera_manager.admin_password.set
tags:
- cm
- default_cluster
- full_cluster
# ENDBLOCK # Install Cloudera Manager
# STARTBLOCK # Cloudera Manager Password
- name: Check Cloudera Manager admin password
hosts: cloudera_manager, cluster
gather_facts: no
roles:
- cloudera.cluster.cloudera_manager.api_client
tags:
- cm
- default_cluster
- full_cluster
# ENDBLOCK # Cloudera Manager Password
# STARTBLOCK # Prepare Security
# Insert AutoTLS with tag
- name: Enable Auto-TLS
hosts: cloudera_manager
gather_facts: no
roles:
- cloudera.cluster.cloudera_manager.autotls
tags:
- autotls
- never
- name: Install pre-requisite packages for Kerberos
hosts: cloudera_manager, cluster
become: yes
roles:
- role: cloudera.cluster.prereqs.kerberos
when: krb5_kdc_host is defined or 'krb5_server' in groups
tags:
- kerberos
- prereqs
- full_cluster
- name: Configure Cloudera Manager server for Kerberos
hosts: cloudera_manager
gather_facts: no
roles:
- role: cloudera.cluster.cloudera_manager.kerberos
when: krb5_kdc_host is defined or 'krb5_server' in groups
tags:
- kerberos
- full_cluster
# ENDBLOCK # Prepare Security
# STARTBLOCK # Install Cluster
- name: Restart Cloudera Manager Agents
hosts: cloudera_manager, cluster
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.operations.restart_agents
tags:
- never
- restart_agents
- name: Ensure that the agents are heartbeating
hosts: cloudera_manager, cluster
gather_facts: yes
any_errors_fatal: yes
roles:
- role: cloudera.cluster.cloudera_manager.wait_for_heartbeat
when: cloudera_manager_agent_wait_for_heartbeat | default(True)
tags:
- heartbeat
- default_cluster
- full_cluster
- name: Deploy Cloudera Management Service
hosts: localhost
gather_facts: no
roles:
- cloudera.cluster.deployment.services.mgmt
tags:
- mgmt
- default_cluster
- full_cluster
- name: Preload parcels from custom repo to Cloudera Manager
hosts: cloudera_manager
become: yes
gather_facts: no
roles:
- role: cloudera.cluster.cloudera_manager.preload_parcels
when: "'custom_repo' in groups"
tags:
- preload_parcels
- default_cluster
- full_cluster
- name: Deploy clusters
hosts: cloudera_manager
gather_facts: no
roles:
- cloudera.cluster.deployment.cluster
tags:
- cluster
- default_cluster
- full_cluster
# ENDBLOCK # Install Cluster
# STARTBLOCK # Setup HDFS Encryption
- name: Setup KTS HA
hosts: localhost
become: yes
gather_facts: no
roles:
- role: cloudera.cluster.deployment.services.kts_high_availability
when:
- "'kts_active' in groups"
- "'kts_passive' in groups"
tags:
- kts
- full_cluster
- name: Handle KMS services
hosts: localhost
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.deployment.services.kms
when: "'kms_servers' in groups"
- role: cloudera.cluster.deployment.services.kms_ha
when: "'kms_servers' in groups"
tags:
- kms
- full_cluster
- name: Handle KMS services
hosts: cloudera_manager
gather_facts: no
become: no
roles:
- role: cloudera.cluster.operations.refresh_ranger_kms_repo
when: "'kms_servers' in groups"
tags:
- kms
- full_cluster
- name: Restart and re-deploy stale client configs
hosts: localhost
gather_facts: no
roles:
- role: cloudera.cluster.operations.restart_stale
when: "'kms_servers' in groups"
vars:
client_config_timeout: "{{ restart_client_config_timeout | default(300) }}"
tags:
- kms
- restart_stale
- full_cluster
# ENDBLOCK # Setup HDFS Encryption
# STARTBLOCK # Teardown
# Teardown CA
- name: Teardown CA server
hosts: ca_server
gather_facts: no
become: yes
tasks:
- ansible.builtin.include_role:
name: cloudera.cluster.infrastructure.ca_certs
tasks_from: clean.yml
tags:
- teardown_ca
- teardown_all
- never
- name: Teardown security artifact directories
hosts: tls
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.security.tls_clean
when: "'tls' in groups"
tags:
- teardown_tls
- teardown_all
- never
# Teardown Cluster
- name: Teardown
hosts: all
gather_facts: no
become: yes
any_errors_fatal: true
roles:
- cloudera.cluster.teardown
tags:
- teardown_cluster
- teardown_all
- never
# ENDBLOCK # Teardown
# End run
###