-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathworkshop_create_openshift4.yaml
More file actions
303 lines (273 loc) · 7.99 KB
/
workshop_create_openshift4.yaml
File metadata and controls
303 lines (273 loc) · 7.99 KB
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
---
## This Playbook will deploy an OpenShift 4 Workshop environment
####################################################################
## Stage 1 Infrastructure and Base Setup
####################################################################
- name: Deploy OpenShift 4 Workshop - Base and Stage 1
hosts: localhost
gather_facts: true
collections:
- community.crypto
- community.general
- ibm.cloudcollection
tasks:
- name: Include IP Definition Vars
include_role:
name: ws-ocp4-tf
tasks_from: shared_vars
# Preflight tasks such as generation directory
- name: Provision Terraform locally
include_role:
name: localTerraform
tags:
- local_terraform
- name: Build infrastructure
include_role:
name: ws-ocp4-tf
vars:
ibmcloud_api_key: "{{ ibmcloud_api_key }}"
tags:
- build_infra
- name: Template out Zones YAML file
include_role:
name: ws-ocp4-tf
tasks_from: template_zones_file
tags:
- template_zones_yaml
- name: Configure DNSNB
include_role:
name: dnsnb
when: dnsnb_provider is defined
tags:
- dnsnb
####################################################################
## DNS Server Config
####################################################################
- name: Connect to DNS VSIs and set configuration
hosts: dns_vsi
collections:
- ansible.posix
gather_facts: true
tasks:
- name: Include IP Definition Vars
include_role:
name: ws-ocp4-tf
tasks_from: shared_vars
- name: Configure DNS servers - FirewallD
include_role:
name: kenmoini.firewalld
tags:
- dns_configuration
- firewalld
vars:
force_restart_of_firewalld: true
firewalld_services:
- ssh
- cockpit
firewalld_ports:
- "53/tcp"
- "53/udp"
- name: Configure DNS servers - Cockpit
include_role:
name: kenmoini.cockpit
tags:
- dns_configuration
- cockpit
- name: Pull in zones variable
include_vars:
file: "{{ tfile_dir }}/zones.yaml"
tags:
- dns_configuration
- zones_configuration
- name: Configure DNS servers
include_role:
name: configureDNSNodes
tags:
- dns_configuration
- dns_daemon_configuration
####################################################################
## Load Balancer Config
####################################################################
- name: Connect to Load Balancers and Run Configuration
hosts: lb_vsi
collections:
- ansible.posix
gather_facts: true
tasks:
- name: Include IP Definition Vars
include_role:
name: ws-ocp4-tf
tasks_from: shared_vars
- name: Configure Load Balancer - FirewallD
include_role:
name: kenmoini.firewalld
tags:
- load_balancer_config
- firewalld
vars:
force_restart_of_firewalld: true
firewalld_services:
- ssh
- cockpit
- http
- https
firewalld_ports:
- 6443/tcp
- 8082/tcp
- 22623/tcp
- name: Configure Load Balancer - Cockpit
include_role:
name: kenmoini.cockpit
tags:
- load_balancer_config
- cockpit
- name: Put SELinux in permissive mode, logging actions that would be blocked.
ansible.posix.selinux:
policy: targeted
state: permissive
register: seLinuxState
tags:
- load_balancer_config
- set_selinux
- name: Reboot when needed
reboot:
reboot_timeout: 3600
when: seLinuxState.reboot_required|bool
tags:
- load_balancer_config
- set_selinux
- reboot
- name: Configure Load Balancer - Deploy HAProxy
include_role:
name: haproxy-lb
vars:
enable_machine_config_server: true
lb_vm_ipaddr: 0.0.0.0
bootstrap_vm_name: bootstrap
bootstrap_vm_ipaddr: "{{ bootstrap_node_internal_ip }}"
control_plane_vsis: "{{ hostvars['localhost']['target_control_plane_vsis'] }}"
app_node_vsis: "{{ hostvars['localhost']['target_app_node_vsis'] }}"
tags:
- load_balancer_config
- deploy_haproxy
- name: Configure Load Balancer - Pilot Light server
include_role:
name: pilot-light-server
vars:
pilot_light_masters_schedulable: true
installConfig_sshKey: "{{ lookup('file', generation_directory+'/id_ssh_rsa.pub') }}"
installConfig_pullSecret: "{{ ocp4_pull_secret }}"
installConfig_baseDomain: "{{ domain }}"
installConfig_name: "{{ guid }}"
installConfig_controlPlaneCount: "{{ ocp_control_plane_count }}"
tags:
- load_balancer_config
- pilot_light_server
####################################################################
## External Base Config
####################################################################
- name: Connect to new external VSIs and set base system updates
hosts: ext_workshop_vsi
collections:
- ansible.posix
gather_facts: true
tasks:
- name: Include IP Definition Vars
include_role:
name: ws-ocp4-tf
tasks_from: shared_vars
- name: Double check on updates
include_role:
name: baseLinuxUpdate
vars:
reboot_after_kernel_update: true
tags:
- global_configuration
- baseLinuxUpdate
- name: Configure FirewallD
include_role:
name: kenmoini.firewalld
tags:
- global_configuration
- firewalld
- never
vars:
force_restart_of_firewalld: true
firewalld_services:
- ssh
- cockpit
- name: Configure Cockpit
include_role:
name: kenmoini.cockpit
tags:
- global_configuration
- cockpit
- never
- name: Set proper hostnames
include_role:
name: setSystemDNS
tasks_from: set_hostnames.yaml
tags:
- set_system_dns
- set_hostnames
- name: Set up System DNS vars
include_role:
name: setSystemDNS
tasks_from: template_system_dns_vars.yaml
with_items: "{{ groups['dns_vsi'] }}"
tags:
- set_system_dns
- name: Set system DNS to deployed servers
include_role:
name: setSystemDNS
when: inventory_hostname not in groups.dns_vsi
vars:
system_search_domain: "{{ guid }}.{{ domain }}"
tags:
- set_system_dns
####################################################################
## Stage 2 Configuration
####################################################################
- name: Deploy OpenShift 4 Workshop - Stage 2
hosts: localhost
gather_facts: true
collections:
- community.crypto
- community.general
- ibm.cloudcollection
tasks:
- name: Include IP Definition Vars
include_role:
name: ws-ocp4-tf
tasks_from: shared_vars
- name: Build Stage 2 Infrastructure - OCP Bootstrap Node
include_role:
name: ws-ocp4-tf
tasks_from: deploy_stage2
tags:
- stage2
# Deploy Stage 3 Terraform - OCP 4 Control Plane Nodes
- name: Wait for 45 seconds while the bootstrap node comes up
pause:
seconds: 45
tags:
- wait_for_bootstrap
- name: Build Stage 3 Infrastructure - OCP Control Plane Nodes
include_role:
name: ws-ocp4-tf
tasks_from: deploy_stage3
tags:
- stage3
# Deploy Stage 4 Terraform - Additional Nodes such as GitLab, Minio, NFS, etc
- name: Wait for 5 minutes while the control plane nodes comes up
pause:
minutes: 5
tags:
- wait_for_control_plane
- name: Build Stage 4 Infrastructure - OCP Control Plane Nodes
include_role:
name: ws-ocp4-tf
tasks_from: deploy_stage4
tags:
- stage4
# Run additional post-cluster deployment configuration