[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
This commit is contained in:
Lukas Bezdicka 2020-06-17 02:58:55 +02:00
parent 52eb92bf9b
commit 0dc690ff1e
2 changed files with 56 additions and 1 deletions

View File

@ -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:

View File

@ -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: |