tripleo-upgrade/tasks/common/undercloud_os_upgrade.yaml

136 lines
3.6 KiB
YAML

---
- 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 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: 'openvswitch2.13'
- file: 'to_keep'
package: 'ceph-ansible'
- name: Download required leapp files
get_url:
url: "https://gitlab.cee.redhat.com/leapp/oamg-rhel7-vagrant/raw/master/roles/init/files/leapp-data/{{ item }}"
dest: "/etc/leapp/files/{{ item }}"
validate_certs: false
mode: '0700'
loop:
- 'pes-events.json'
- 'device_driver_deprecation_data.json'
- 'repomap.json'
- 'unsupported_driver_names.json'
- 'unsupported_pci_ids.json'
register: get_url_result
until: get_url_result.status_code == 200
delay: 10
retries: 3
- 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: 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) %} LEAPP_UNSUPPORTED=1 LEAPP_NO_RHSM=1 {% endif %}\
{% if leapp_skip_release_check|bool %} LEAPP_DEVEL_SKIP_CHECK_OS_RELEASE=1 {% 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