-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbootstrap.yaml
399 lines (374 loc) · 9.54 KB
/
bootstrap.yaml
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
# Finish hosts prep on dedicated instances
- hosts: bigbluebutton:elasticsearch:freeipa
tasks:
- include_role:
name: commons
when:
- not (is_on_shared_hardware | default(False))
# Configures Firewall
- hosts: lb:postgres:redis:sshfs:reverse:coturn
tasks:
- include_role:
name: firehol
when:
- setup_firewall | default(True)
- not (is_on_shared_hardware | default(False))
# Initilizes BBB PKI
# Generates Certificates to BBB, Greenlight, Scalelite,
# AlertManager & Prometheus
- hosts: bbb:bbbcsp:scalelite:greenlight:peertube:prometheus:grafana:alertmanager:coturn:kibana
roles:
- { name: pki, when: bbb_uses_selfsigned | default(True) }
- hosts: bbb
serial: 1
tasks:
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ bigbluebutton_fqdn | default(ansible_fqdn) }}"
when:
- ansible_hostname not in groups['greenlight']
- ansible_nodename not in groups['greenlight']
- ansible_fqdn not in groups['greenlight']
- bbb_uses_selfsigned | default(True)
- hosts: greenlight
serial: 1
tasks:
- name: Fail on missing Greenlight FQDN
fail:
msg: |
Greenlight FQDN has to be set, deploying multiple servers
when:
- groups['greenlight'] | length > 1
- not (greenlight_fqdn | default(False))
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ greenlight_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
- hosts: peertube
serial: 1
tasks:
- name: Fail on missing PeerTube FQDN
fail:
msg: |
PeerTube FQDN has to be set, deploying multiple servers
when:
- groups['peertube'] | length > 1
- not (peertube_fqdn | default(False))
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ peertube_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
- hosts: scalelite
serial: 1
tasks:
- name: Fail on missing Scalelite FQDN
fail:
msg: |
Scalelite FQDN has to be set, deploying multiple servers
when:
- groups['scalelite'] | length > 1
- not (scalelite_fqdn | default(False))
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ scalelite_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
- hosts: bbbcsp
serial: 1
tasks:
- name: Fail on missing BBB-CSP FQDN
fail:
msg: |
BigBlueButton Conferences Streaming Platform FQDN has to be set, deploying multiple servers
when:
- groups['bbbcsp'] | length > 1
- not (bbbcsp_fqdn | default(False))
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ bbbcsp_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
- hosts: coturn
serial: 1
tasks:
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ coturn_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
- hosts: kibana
serial: 1
tasks:
- name: Fail on missing Kibana FQDN
fail:
msg: |
Kibana FQDN has to be set, deploying multiple servers
when:
- groups['kibana'] | length > 1
- not (kibana_fqdn | default(False))
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ kibana_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
- hosts: alertmanager
serial: 1
tasks:
- name: Fail on missing AlertManager FQDN
fail:
msg: |
AlertManager FQDN has to be set, deploying multiple servers
when:
- groups['alertmanager'] | length > 1
- not (alertmanager_fqdn | default(False))
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ alertmanager_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
- ansible_fqdn not in groups['prometheus']
- ansible_hostname not in groups['prometheus']
- ansible_nodename not in groups['prometheus']
- ansible_fqdn not in groups['grafana']
- ansible_hostname not in groups['grafana']
- ansible_nodename not in groups['grafana']
- hosts: prometheus
serial: 1
tasks:
- name: Fail on missing Prometheus FQDN
fail:
msg: |
Prometheus FQDN has to be set, deploying multiple servers
when:
- groups['prometheus'] | length > 1
- not (prometheus_fqdn | default(False))
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ prometheus_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
- ansible_fqdn not in groups['grafana']
- ansible_hostname not in groups['grafana']
- ansible_nodename not in groups['grafana']
- hosts: grafana
serial: 1
tasks:
- name: Fail on missing Grafana FQDN
fail:
msg: |
Grafana FQDN has to be set, deploying multiple servers
when:
- groups['grafana'] | length > 1
- not (grafana_fqdn | default(False))
- include_role:
name: pki
tasks_from: generate-cert.yaml
vars:
cert_fqdn: "{{ grafana_fqdn | default(ansible_fqdn) }}"
when:
- bbb_uses_selfsigned | default(True)
# Setup Pacemaker / Corosync on elligible groups
- hosts: pacemaker
tasks:
- include_role:
name: pacemaker
loop:
- bbbcsp
- peertube
- postgres_coturn
- postgres_grafana
- postgres_greenlight
- postgres_openstreamingplatform
- postgres_peertube
- postgres_scalelite
- redis_peertube
- redis_scalelite
- reverse
- scalelite
loop_control:
loop_var: apply_to
when:
- groups[apply_to] | length > 1
- >
ansible_nodename in groups[apply_to]
or ansible_hostname in groups[apply_to]
or ansible_fqdn in groups[apply_to]
- (corosync_members | default([])) | length > 1
- corosync_multicast_address | default(False)
# Setup DRBD on elligible groups
- hosts: drbd
tasks:
- include_role:
name: drbd
loop:
- peertube
- postgres_coturn
- postgres_grafana
- postgres_greenlight
- postgres_openstreamingplatform
- postgres_peertube
- postgres_scalelite
- redis_peertube
- redis_scalelite
- scalelite
loop_control:
loop_var: apply_to
when:
- groups[apply_to] | length > 1
- >
ansible_nodename in groups[apply_to]
or ansible_hostname in groups[apply_to]
or ansible_fqdn in groups[apply_to]
- (corosync_members | default([])) | length > 1
- drbd_resource_name | default(False)
# Prepare Shared FS
# a demo deployment would come without any network filesystem
# otherwise: only one of these would be required, distributing Scalelite
- hosts: nfs
roles:
- nfs
- hosts: scalelite
tasks:
- include_role:
name: cephfs
when:
- groups['cephfs'] | length > 0
- hosts: sshfs
roles:
- sshfs
# Installs Redis
# only required when deploying PeerTube or Scalelite
- hosts: redis_peertube:redis_scalelite
roles:
- redis
# Installs Postgres
# provisions Greenlight, Moodle PeerTube & Scalelite databases & users
- hosts: postgres
roles:
- postgres
# Installs HAProxy for backend services
# sends PeerTube & Scalelite clients to redis Master, Prometheus to
# AlertManager, Grafana to Prometheus
- hosts: lb_back
roles:
- haproxy
# Installs Coturn
- hosts: coturn
roles:
- coturn
# Installs BigBlueButton
- hosts: bbb
tasks:
- include_role:
name: bigbluebutton
when:
- not (skip_bbb | default(False))
# Installs Scalelite
- hosts: scalelite
roles:
- scalelite
# Registers BigBlueButton backends to Scalelite
- hosts: scalelite
tasks:
- include_role:
name: scalelite
tasks_from: init-backends.yaml
when:
- groups['bbb'] | length > 0
- not (skip_bbb | default(False))
# Trusts Scalelite SSH Hostkey in BBB
- hosts: bbb
tasks:
- include_role:
name: bigbluebutton
tasks_from: ssh-keyscan.yaml
when:
- groups['cephfs'] | length == 0
- groups['nfs'] | length == 0
- not (skip_bbb | default(False))
# Installs HAProxy for frontend services
# -- don't re-apply, if host also member of lb_back group
- hosts: lb_front
tasks:
- include_role:
name: haproxy
when:
- not (ansible_fqdn in groups['lb_back'])
- not (ansible_hostname in groups['lb_back'])
- not (ansible_nodename in groups['lb_back'])
# Installs Nginx Reverse Proxy
- hosts: reverse
roles:
- reverse
serial: 1
# Installs Greenlight
- hosts: greenlight
roles:
- greenlight
# Installs OpenStreamingPlatform
- hosts: openstreamingplatform
roles:
- openstreamingplatform
# Installs PeerTube
- hosts: peertube
roles:
- peertube
# Installs BigBlueButton Conferences Streaming Platform
- hosts: bbbcsp
roles:
- bbbcsp
# Installs ElasticSearch
- hosts: elasticsearch
roles:
- elasticsearch
# Configures Fail2ban
- hosts: bastion:bbb:coturn:lb_front:reverse
tasks:
- include_role:
name: fail2ban
when:
- setup_fail2ban | default(True)
- not (is_on_shared_hardware | default(False))
# Configures Logs Forwarding
- hosts: bigbluebutton:elasticsearch:freeipa
tasks:
- include_role:
name: fluentd
when:
- groups['elasticsearch'] | length > 0
# Installs Kibana
- hosts: kibana
roles:
- kibana
# Installs AlertManager
- hosts: alertmanager
roles:
- alertmanager
# Installs Prometheus
- hosts: prometheus
roles:
- prometheus
# Installs Grafana
- hosts: grafana
roles:
- grafana