-
Notifications
You must be signed in to change notification settings - Fork 39
/
00_prerequisites.yml
67 lines (58 loc) · 3.19 KB
/
00_prerequisites.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
---
- name: This play ensures prerequisites are satisfied before installing
hosts: vm_host
vars_files:
- vars/cluster_vars.yml
- vars/infra_vars.yml
tasks:
- name: Check if distribution is supported
ansible.builtin.fail:
msg: Your distribution is actually unsupported
when:
- ansible_distribution != 'CentOS'
- ansible_distribution != 'Fedora'
- ansible_distribution != 'RedHat'
- name: Block of cluster checks
block:
- name: Fail fast if more than one bootstrap node is provided
ansible.builtin.fail:
msg: "Only ONE bootstrap node can be present"
when: cluster_nodes.host_list.bootstrap | count > 1
- name: Fail fast if more than one bootstrap node is provided
ansible.builtin.fail:
msg: "Versions before 4.10 are not supported"
when:
- cluster.version != "stable"
- cluster.version is version('4.10', '<')
- name: Fail fast when no workers are provided and it's not in Compact mode (three nodes)
ansible.builtin.fail:
msg: 'To provision NO workers, you must flag "three_node" varible to true in vars/cluster_vars.yml'
when:
- (cluster_nodes.host_list.workers | count <= 0)
- not three_node
- name: Fail fast if hosts are missing from the list
ansible.builtin.fail:
msg: "Please check the host_list variable in cluster_nodes"
when: (cluster_nodes.host_list.masters | count <= 0) or
(cluster_nodes.host_list.workers | count <= 0) or
(cluster_nodes.host_list.bootstrap | count <= 0)
- name: Fail fast if bootstrap node doesn't meet minimum requirements
ansible.builtin.fail:
msg: "Bootstrap nodes must be provisioned with at least 16GB memory, 40GB storage and 4vCPUs"
when: (cluster_nodes.specs.bootstrap.vcpu < 4) or (cluster_nodes.specs.bootstrap.mem < 16) or (cluster_nodes.specs.bootstrap.disk < 40)
- name: Fail fast if master nodes don't meet minimum requirements
ansible.builtin.fail:
msg: "Master nodes must be provisioned with at least 16GB memory, 40GB storage and 4vCPUs"
when: (cluster_nodes.specs.masters.vcpu < 4) or (cluster_nodes.specs.masters.mem < 16) or (cluster_nodes.specs.masters.disk < 40)
- name: Fail fast if worker nodes don't meet minimum requirements
ansible.builtin.fail:
msg: "Worker nodes must be provisioned with at least 8GB memory and 2vCPUs"
when: (cluster_nodes.specs.workers.vcpu < 2) or (cluster_nodes.specs.workers.mem < 8) or (cluster_nodes.specs.workers.disk < 40)
- name: Check for pullSecret variable and fail fast
ansible.builtin.fail:
msg: "Check the pullSecret var in files/vars.yaml"
when: (cluster.pullSecret is undefined) or (cluster.pullSecret | length < 1)
- name: Fail fast if bastion and/or loadbalancer are not provided
ansible.builtin.fail:
msg: "At least one bastion and one loadbalancer VMs must be created"
when: (infra_nodes.host_list.bastion | count != 1 or infra_nodes.host_list.loadbalancer | count != 1)