This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
/
undercloud_os_upgrade.yaml
171 lines (155 loc) · 5.31 KB
/
undercloud_os_upgrade.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
---
- name: run playbook from Undercloud to rename ethX interfaces
shell: |
set -o pipefail
ansible-playbook -v -c local -i localhost, -e prefix={{ nic_prefix }} -e undercloud_conf={{ undercloud_conf }} \
{{ working_dir }}/rename-nics.yaml 2>&1 {{ timestamper_cmd }} >> {{ working_dir}}/undercloud-rename-nics.log
when: "ansible_interfaces | select('match', '^eth[0-9]+') | list | length > 1"
- name: Remove old RHEL7 packages
# Remove all el7ost packages except those which could imply the removal
# (direct or indirect) of the leapp and subscription-manager packages.
shell: >-
yum -y remove
*el7ost*
galera*
haproxy*
httpd
mysql*
pacemaker*
xinetd
python-jsonpointer
qemu-kvm-common-rhev
qemu-img-rhev
rabbit*
redis*
python3*
--
-*openvswitch*
-python-docker
-python-PyMySQL
-python-pysocks
-python2-asn1crypto
-python2-babel
-python2-cffi
-python2-cryptography
-python2-dateutil
-python2-idna
-python2-ipaddress
-python2-jinja2
-python2-jsonpatch
-python2-markupsafe
-python2-pyOpenSSL
-python2-requests
-python2-six
-python2-urllib3
-python-httplib2
-python-passlib
-python2-netaddr
-ceph-ansible
-python2-chardet
- name: Install jq
package:
name:
- jq
- name: Install leapp
package:
name:
- leapp
- leapp-repository
state: latest
when:
- not leapp_unsubscribed|bool
- name: "Add packages into leapp's to_remove/to_install/to_keep files"
lineinfile:
path: "/etc/leapp/transaction/{{ item.file }}"
line: "{{ item.package }}"
loop:
- file: 'to_remove'
package: 'openvswitch2.11'
- file: 'to_install'
package: 'openvswitch{{ leapp_ovs_version }}'
- file: 'to_keep'
package: 'ceph-ansible'
- name: Set required leapp answers
shell: |
# PAM module pam_pkcs11 is no longer available in RHEL-8 since it was replaced by SSSD
leapp answer --section remove_pam_pkcs11_module_check.confirm=True --add
# Required for TLS-Everywhere, switch from authconfig to authselect
leapp answer --section authselect_check.confirm=True --add
- name: Remove leapp actors to prevent them inhibiting the upgrade
command:
cmd: find /usr/share/leapp-repository/repositories/ -name {{ item }} -type d -print -exec rm -rf "{}" +
loop: "{{ leapp_actors_to_remove }}"
- name: Check if rhos-release is installed
package:
name: rhos-release
state: present
check_mode: true
failed_when: false
register: rhos_release_installed
- block:
- name: Remove rhos-release repos
command: rhos-release -x
- name: Remove conflicting rhos-release package
package:
name: rhos-release
state: absent
when:
- not leapp_unsubscribed|bool
- rhos_release_installed.rc == 0
- not rhos_release_installed.changed
- name: "Delete the kernel modules in Leapp database (removed_drivers.txt) that are no longer supported in RHEL 8 (rhbz#1962365 < leapp-upgrade-el7toel8-0.15)"
vars:
modules_to_unload: ['pata_acpi', 'floppy']
lineinfile:
path: "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/kernel/checkkerneldrivers/files/removed_drivers.txt"
regexp: "{{ item }}"
state: absent
loop: "{{ modules_to_unload }}"
- name: "Delete the kernel modules in Leapp database (device_driver_deprecation_data.json) that are no longer supported in RHEL 8 (rhbz#2064383 > leapp-upgrade-el7toel8-0.16.0)"
vars:
modules_to_unload: ['pata_acpi', 'floppy']
shell: >
set -o pipefail &&
jq '. | del(.data[] | select(.driver_name == "{{ item }}"))'
/etc/leapp/files/device_driver_deprecation_data.json >
/etc/leapp/files/device_driver_deprecation_data.json_modified &&
mv /etc/leapp/files/device_driver_deprecation_data.json_modified
/etc/leapp/files/device_driver_deprecation_data.json
loop: "{{ modules_to_unload }}"
- name: Get enablerepo line for leapp
shell: |
yum repolist -q 2> /dev/null | grep -e rhos-16 -e 'rhel-8.*baseos' -e 'rhel-8.*appstream' -e 'rhel-8.*fdp' -e 'rhel-8.*av' -e 'ansible' | cut -d '/' -f1 | \
awk '{print "--enablerepo " $0 " "}' | tr -d '\n'
when: leapp_unsubscribed|bool
register: leapp_unsubscribed_options
- name: Run leapp upgrade (download packages)
shell: |
set -o pipefail
{% if leapp_unsubscribed|bool and (upgrade_workarounds|bool or ffu_upgrade_workarounds|bool) %}
export LEAPP_UNSUPPORTED=1
export LEAPP_NO_RHSM=1
{% endif %}
{% if leapp_skip_release_check|bool %}
export LEAPP_DEVEL_SKIP_CHECK_OS_RELEASE=1
{% endif %}
{% if lookup('env', 'UPGRADE_RHEL_VERSION') != '' %}
export LEAPP_DEVEL_TARGET_RELEASE={{ lookup('env', 'UPGRADE_RHEL_VERSION') }}
{% endif %}
sudo -E leapp upgrade \
{% if leapp_unsubscribed|bool %} {{ leapp_unsubscribed_options.stdout }} {% endif %} \
--debug 2>&1 | tee {{ working_dir }}/undercloud_leapp_upgrade.log
- name: Relabel SELinux for filesystem after reboot.
file:
path: /.autorelabel
state: touch
# Reboot, and wait for 30 mins
- name: Reboot the undercloud
reboot:
reboot_timeout: 1800
- name: Unregister the node once the OS was upgraded if desired
redhat_subscription:
state: absent
when:
- leapp_unregister|bool
- not leapp_unsubscribed|bool