-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
upgrade.yml
66 lines (55 loc) · 2.03 KB
/
upgrade.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
---
- block:
- debug:
msg: "Running openshift_node_pre_cordon_hook {{ openshift_node_pre_cordon_hook }}"
- include_tasks: "{{ openshift_node_pre_cordon_hook }}"
when: openshift_node_pre_cordon_hook is defined
- name: Cordon node prior to upgrade
command: >
oc adm cordon {{ ansible_nodename | lower }}
--kubeconfig={{ openshift_node_kubeconfig_path }}
delegate_to: localhost
- name: Drain node prior to upgrade
command: >
oc adm drain {{ ansible_nodename | lower }}
--kubeconfig={{ openshift_node_kubeconfig_path }}
--force --delete-local-data --ignore-daemonsets
delegate_to: localhost
# Run the openshift_node_pre_upgrade_hook if defined
- block:
- debug:
msg: "Running node openshift_node_pre_upgrade_hook {{ openshift_node_pre_upgrade_hook }}"
- include_tasks: "{{ openshift_node_pre_upgrade_hook }}"
when: openshift_node_pre_upgrade_hook is defined
- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto
- name: Remove conflicts from openshift-hyperkube
dnf:
name: openshift-hyperkube
state: absent
when:
- "'openshift-hyperkube' in ansible_facts.packages"
# Upgrade Node Packages
- import_tasks: install.yml
# Apply machine config
- import_tasks: apply_machine_config.yml
# Run the openshift_node_pre_uncordon_hook if defined
- block:
- debug:
msg: "Running openshift_node_pre_uncordon_hook {{ openshift_node_pre_uncordon_hook }}"
- include_tasks: "{{ openshift_node_pre_uncordon_hook }}"
when: openshift_node_pre_uncordon_hook is defined
- name: Uncordon node after upgrade
command: >
oc adm uncordon {{ ansible_nodename | lower }}
--kubeconfig={{ openshift_node_kubeconfig_path }}
delegate_to: localhost
# Run the openshift_node_post_upgrade_hook if defined
- block:
- debug:
msg: "Running node openshift_node_post_upgrade_hook {{ openshift_node_post_upgrade_hook }}"
- include_tasks: "{{ openshift_node_post_upgrade_hook }}"
when: openshift_node_post_upgrade_hook is defined
# Preserve SE Linux data
- import_tasks: selinux.yml