From 52993719574c72c6af2ed05d61f40056e9359b18 Mon Sep 17 00:00:00 2001 From: Lon Hohberger Date: Mon, 24 Aug 2020 09:51:58 -0400 Subject: [PATCH] rhel-common: Provide method to select module streams Some OpenStack releases on RHEL require specific modules in order to function correctly. This adds the ability to set DIB_DNF_MODULE_STREAMS which then are selected prior to package installation. Change-Id: I78d7bcf214a45245e2073428120fcbdd968e1acd Signed-off-by: Lon Hohberger --- .../elements/rhel-common/README.rst | 27 ++++++++++++++++--- .../pre-install.d/01-module-configuration | 22 +++++++++++++++ ...hel-module-selection-e9f6f06ece1fb829.yaml | 5 ++++ 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100755 diskimage_builder/elements/rhel-common/pre-install.d/01-module-configuration create mode 100644 releasenotes/notes/rhel-module-selection-e9f6f06ece1fb829.yaml diff --git a/diskimage_builder/elements/rhel-common/README.rst b/diskimage_builder/elements/rhel-common/README.rst index f493cd446..7c6401093 100644 --- a/diskimage_builder/elements/rhel-common/README.rst +++ b/diskimage_builder/elements/rhel-common/README.rst @@ -24,15 +24,19 @@ Satellite. An activation key can only be used for registration purposes using the subscription-manager command line tool and is considered a lower security risk. -IMPORTANT NOTE: +IMPORTANT NOTES: ---------------- The 00-rhsm script is specific to RHEL6. If you use the REG\_ variables to use with RHEL7, you do not need to set any DIB_RHSM variables. The scripts named with "rhel-registration" have not been developed or tested for RHEL6. For information on building RHEL6 images, please see the rhel element README. -Environment Variables For Image Creation ----------------------------------------- +The 01-module-configuration script is specific to RHEL8. RHEL8 includes +various versions of software which can be selected during installation, some +may be older and/or incompatible with a given release of OpenStack. + +Environment Variables For Regisration during Image Creation +----------------------------------------------------------- The following environment variables are used for registering a RHEL instance with either the Red Hat Customer Portal or Satellite 6. @@ -244,3 +248,20 @@ use the following metadata:: } } + +Environment Variables for Module Selection during Image Creation +---------------------------------------------------------------- +The following environment variable is used to select module streams to be +enabled during an image build on RHEL8. Any existing stream for the given +module is first disabled prior to enabling the specified stream. + +#### DIB\_DNF\_MODULE\_STREAMS +This is a space-separated list of module streams to enable prior to any +RPMs being installed. + +Image Build Module Selection Example +------------------------------------ +When using Train on RHEL8.2, one must select the appropriate virt and +container-tools module streams: + +DIB_DNF_MODULE_STREAMS='virt:8.2 container-tools:2.0' diff --git a/diskimage_builder/elements/rhel-common/pre-install.d/01-module-configuration b/diskimage_builder/elements/rhel-common/pre-install.d/01-module-configuration new file mode 100755 index 000000000..0d29557f5 --- /dev/null +++ b/diskimage_builder/elements/rhel-common/pre-install.d/01-module-configuration @@ -0,0 +1,22 @@ +#!/bin/bash +# +# When building RHEL overcloud images, certain modules may be preferred +# or even required. +# +# For example, container-tools:2.0 is notably a requirement when running +# the Train releases on RHEL 8.2. +# + +if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then + set -x +fi + +set -eu +set -o pipefail + +if [ "${YUM}" == "dnf" ]; then + for m in ${DIB_DNF_MODULE_STREAMS}; do + ${YUM} -y module disable ${m/:*/} + ${YUM} -y module enable ${m} + done +fi diff --git a/releasenotes/notes/rhel-module-selection-e9f6f06ece1fb829.yaml b/releasenotes/notes/rhel-module-selection-e9f6f06ece1fb829.yaml new file mode 100644 index 000000000..0971e481a --- /dev/null +++ b/releasenotes/notes/rhel-module-selection-e9f6f06ece1fb829.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + New environment variable enables the ability to select specific module + streams prior to RPM installation on RHEL8 and later.