diff --git a/bindep.txt b/bindep.txt index 4cc867949..4f3b0b955 100644 --- a/bindep.txt +++ b/bindep.txt @@ -1,6 +1,3 @@ -# NOTE(rpittau): the EPEL repository for centos 9 stream should be -# epel-next but it's not ready yet -epel-release [platform:centos-8 platform:rhel-8] gcc git libffi-devel [platform:redhat platform:suse] diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index b7fd8e058..fa4591a8b 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -28,6 +28,7 @@ create_image_via_dib: "{{ not use_cirros | default(false) | bool }}" create_ipa_image: false dib_image_type: vm dib_os_element: "debian" +enable_epel: "{{ install_dib | bool }}" # Setting to install diskimage-builder install_dib: "{{ create_image_via_dib | bool or create_ipa_image | bool }}" ironic_debug: true diff --git a/playbooks/roles/bifrost-ironic-install/tasks/install.yml b/playbooks/roles/bifrost-ironic-install/tasks/install.yml index 6eaf3dceb..0473a8828 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/install.yml @@ -17,6 +17,26 @@ apt: update_cache=yes when: ansible_os_family == 'Debian' +- block: + - name: "Enable powertools repository for CentOS Stream 8" + command: dnf config-manager --set-enabled powertools + - name: "Enable EPEL repository for CentOS Stream 8" + command: dnf install -y epel-release + when: + - enable_epel | bool + - dib_os_element == "debian" + when: + - ansible_distribution == "CentOS" + - ansible_distribution_version|int == 8 + +- name: "Enable EPEL repository for CentOS Stream 9" + command: dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + when: + - enable_epel | bool + - dib_os_element == "debian" + - ansible_distribution == "CentOS" + - ansible_distribution_version|int >= 9 + - name: "Install packages" package: name: "{{ required_packages }}" @@ -57,7 +77,18 @@ package: name: "{{ dib_host_required_packages | select | list }}" state: present - when: install_dib | bool + when: + - install_dib | bool + - ansible_distribution != "CentOS" + +- name: Ensure required packages are installed + dnf: + name: "{{ dib_host_required_packages | select | list }}" + enablerepo: epel + state: present + when: + - install_dib | bool + - ansible_distribution == "CentOS" - name: "sushy - Install" include_role: diff --git a/releasenotes/notes/conditional-epel-b52ad3ad29f195f5.yaml b/releasenotes/notes/conditional-epel-b52ad3ad29f195f5.yaml new file mode 100644 index 000000000..b58418413 --- /dev/null +++ b/releasenotes/notes/conditional-epel-b52ad3ad29f195f5.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Add a boolean variable ``enable_epel`` that allows to enable the epel + repository for CentOS Stream 8/9. Since we need that only when + building a debian-based IPA image, the default value is set to + ``install_dib`` and its installation depends on the value of the + dib_os_element used. diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index 1a4b4a59e..a8f455c91 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -97,16 +97,6 @@ elif [ ${BUILD_IMAGE} = "true" ]; then DOWNLOAD_IPA=false CREATE_IPA_IMAGE=true - # if running in OpenStack CI, then make sure epel is enabled - # since it may already be present (but disabled) on the host - # we need epel for debootstrap - if env | grep -q ^ZUUL; then - if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then - sudo dnf install -y dnf-utils - sudo dnf install -y epel-release || true - sudo dnf config-manager --set-enabled epel || true - fi - fi elif [ ${ENABLE_KEYSTONE} = "true" ]; then NOAUTH_MODE=false CLOUD_CONFIG+=" -e cloud_name=bifrost"