From 0dc690ff1e002d303d5daeadabf448c11cbaf91b Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Wed, 17 Jun 2020 02:58:55 +0200 Subject: [PATCH] [TRAIN ONLY] Provide way to initialize Leapp The Leapp utility can require enabling extra repositories and it must be provided with data [1] to perform in-place upgrade from RHEL7 to RHEL8. We allow passing thsese with parameters LeappRepoInitCommand and LeappInitCommand. To make sure most users will not have to pass LeappInitCommand we sync the files from Undercloud. Lastly we default the UpgradeLeappCommandOptions to have default OSP16 repositories enabled forcing users to either change this value or properly subscribe. Example: LeappRepoInitCommand: | subscription-manager repos --enable rhel-7-server-rpms subscription-manager repos --enable rhel-7-server-extras-rpms LeappInitCommand: | sudo curl -4ksSL -o /etc/leapp/files/pes-events.json https://example.com/pes-events.json sudo curl -4ksSL -o /etc/leapp/files/repomap.csv https://example.com/repomap.csv [1] - https://access.redhat.com/articles/3664871 Resolves: rhbz#1845726 Change-Id: Ibd57468623717273c29d473d32a76f37ae02fa31 --- .../tripleo-packages-baremetal-puppet.yaml | 56 ++++++++++++++++++- environments/lifecycle/upgrade-prepare.yaml | 1 + 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/deployment/tripleo-packages/tripleo-packages-baremetal-puppet.yaml b/deployment/tripleo-packages/tripleo-packages-baremetal-puppet.yaml index 98fefa6a64..15eb7a62cd 100644 --- a/deployment/tripleo-packages/tripleo-packages-baremetal-puppet.yaml +++ b/deployment/tripleo-packages/tripleo-packages-baremetal-puppet.yaml @@ -84,6 +84,18 @@ parameters: default: [] description: List of packages to install after Leapp upgrade. type: comma_delimited_list + LeappRepoInitCommand: + type: string + description: | + Command or script snippet to run on all overcloud nodes to + initialize the Leapp process. E.g. a repository switch. + default: '' + LeappInitCommand: + type: string + description: | + Command or script snippet to run on all overcloud nodes to + apply any necessary workarounds to get Leapp working. + default: '' UpgradeInitCommand: type: string description: | @@ -190,10 +202,53 @@ outputs: -python2-requests -python2-six -python2-urllib3 + - name: Run LeappRepoInitCommand + shell: + list_join: + - '' + - - "#!/bin/bash\n\n" + - {get_param: LeappRepoInitCommand} - name: install leapp package: name: leapp state: latest + - name: Check that the /etc/leapp/files/pes-events.json exists on UC + delegate_to: undercloud + stat: + path: '/etc/leapp/files/pes-events.json' + register: pes_present + - name: Check that the /etc/leapp/files/repomap.csv exists on UC + delegate_to: undercloud + stat: + path: '/etc/leapp/files/repomap.csv' + register: repomap_present + - name: Fetch the Leapp data from undercloud + fetch: + dest: '{{ playbook_dir }}' + src: '{{ item }}' + delegate_to: undercloud + with_items: + - /etc/leapp/files/pes-events.json + - /etc/leapp/files/repomap.csv + when: + - repomap_present.stat.exists + - pes_present.stat.exists + - name: Copy the Leapp data from undercloud + copy: + dest: '{{ item }}' + src: '{{ playbook_dir }}/{{ inventory_hostname }}/{{ item }}' + with_items: + - /etc/leapp/files/pes-events.json + - /etc/leapp/files/repomap.csv + when: + - repomap_present.stat.exists + - pes_present.stat.exists + - name: Run LeappInitCommand + shell: + list_join: + - '' + - - "#!/bin/bash\n\n" + - {get_param: LeappInitCommand} - name: "add packages into Leapp's to_remove file" vars: pkg_to_remove: { get_param: UpgradeLeappToRemove } @@ -259,7 +314,6 @@ outputs: list_join: - '' - - "#!/bin/bash\n\n" - - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n" - {get_param: UpgradeInitCommand} - name: Run UpgradeInitCommonCommand shell: diff --git a/environments/lifecycle/upgrade-prepare.yaml b/environments/lifecycle/upgrade-prepare.yaml index 213601ecac..ad547b7041 100644 --- a/environments/lifecycle/upgrade-prepare.yaml +++ b/environments/lifecycle/upgrade-prepare.yaml @@ -8,6 +8,7 @@ resource_registry: OS::TripleO::Services::MongoDb: OS::Heat::None parameter_defaults: + UpgradeLeappCommandOptions: " --enablerepo rhel-8-for-x86_64-baseos-eus-rpms --enablerepo rhel-8-for-x86_64-appstream-eus-rpms --enablerepo rhel-8-for-x86_64-highavailability-eus-rpms --enablerepo advanced-virt-for-rhel-8-x86_64-rpms --enablerepo ansible-2.9-for-rhel-8-x86_64-rpms --enablerepo fast-datapath-for-rhel-8-x86_64-rpms " EnablePackageInstall: true UpgradeLevelNovaCompute: '' UpgradeInitCommonCommand: |