-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
install.yml
122 lines (108 loc) · 3.39 KB
/
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
---
- name: Retrieve rendered-worker name
command: >
oc get machineconfigpool worker
--kubeconfig={{ openshift_node_kubeconfig_path }}
--output=jsonpath='{.status.configuration.name}'
delegate_to: localhost
run_once: true
register: rendered_worker
until:
- rendered_worker.stdout != ''
changed_when: false
- name: Check cluster FIPS status
command: >
oc get machineconfig {{ rendered_worker.stdout }}
--kubeconfig={{ openshift_node_kubeconfig_path }}
--output=jsonpath='{.spec.fips}'
delegate_to: localhost
run_once: true
register: cluster_fips
until:
- cluster_fips.stdout != ''
changed_when: false
- name: Fail if host FIPS status does not match cluster FIPS status
fail:
msg: >
Host FIPS status of '{{ ansible_fips }}' does not match
cluster FIPS status of '{{ cluster_fips.stdout | bool }}'.
Please update the host configuration before proceeding.
when:
- ansible_fips != (cluster_fips.stdout | bool)
- name: Install openshift support packages
package:
name: "{{ openshift_node_support_packages | join(',') }}"
state: latest
update_cache: true
async: 3600
poll: 30
register: result
until: result is succeeded
- name: Get cluster version
command: >
oc get clusterversion
--kubeconfig={{ openshift_node_kubeconfig_path }}
--output=jsonpath='{.items[0].status.desired.version}'
delegate_to: localhost
register: oc_get
until:
- oc_get.stdout != ''
changed_when: false
- name: Set fact l_cluster_version
set_fact:
l_cluster_version: "{{ oc_get.stdout | regex_search('^\\d+\\.\\d+') }}"
- name: Get kubernetes server version
command: >
oc version
--kubeconfig={{ openshift_node_kubeconfig_path }}
--output=json
delegate_to: localhost
register: oc_get
until:
- oc_get.stdout != ''
changed_when: false
- name: Set fact l_kubernetes_server_version
set_fact:
l_kubernetes_server_version: "{{ (oc_get.stdout | from_json).serverVersion.major ~ '.' ~ (oc_get.stdout | from_json).serverVersion.minor | regex_search('^\\d+') }}"
- name: Get available cri-o RPM versions
package:
list: cri-o
register: crio_version
- name: Set fact crio_latest
set_fact:
crio_latest: "{{ crio_version.results | selectattr('yumstate', 'match', 'available') | map(attribute='version') | list | last }}"
- name: Fail if cri-o is less than current kubernetes server version
fail:
msg: >
Latest available cri-o ({{ crio_latest }}) version is less than current
kubernetes server version ({{ l_kubernetes_server_version }}).
when:
- crio_latest is version(l_kubernetes_server_version, 'lt')
- block:
- name: Install openshift packages
package:
name: "{{ openshift_node_packages | join(',') }}"
state: latest
async: 3600
poll: 30
register: result
until: result is succeeded
rescue:
- name: Package install failure message
fail:
msg: >
Unable to install {{ openshift_node_packages | join(', ') }}.
Please ensure repos are configured properly to provide these packages
and indicated versions.
- name: Enable the CRI-O service
systemd:
name: "crio"
enabled: yes
# persistent storage in journal is needed for MachineConfig to work
- name: Enable persistent storage on journal
ini_file:
dest: "/etc/systemd/journald.conf"
section: Journal
option: Storage
value: "persistent"
no_extra_spaces: yes