From 62171d00f3595c80697f1a125c104423e230b1ee Mon Sep 17 00:00:00 2001 From: Erik Berg Date: Wed, 12 Oct 2022 05:40:24 +0200 Subject: [PATCH] Enable epel repository for more than CentOS The epel repository contains among other things 'debootstrap', which is needed by dib_host_required_packages, whenever dib_os_element contains the word 'debian' (or 'ubuntu'), which is the default[1] and install_dib is true which it also is by default[2] This improves upon I57513883c0fa8d6ffb2c70debb81d5e7e6d8b221 where the documentation[3] and procedure has probably been updated since it was last followed. We can also remove the conditional installation of dib_host_required_packages with enablerepo: epel for centos [1] bifrost-ironic-install/defaults/main.yml:dib_os_element: "debian" [2] bifrost-ironic-install/defaults/main.yml:install_dib: "{{ create_image_via_dib | bool or create_ipa_image | bool }}" bifrost-ironic-install/defaults/main.yml:create_image_via_dib: "{{ not use_cirros | default(false) | bool }}" bifrost-ironic-install/defaults/main.yml:use_cirros: false [3] https://docs.fedoraproject.org/en-US/epel/#_el9 Change-Id: Ia16b544df261b999b1503ee110ec88f39becd7dd --- .../bifrost-ironic-install/tasks/install.yml | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/playbooks/roles/bifrost-ironic-install/tasks/install.yml b/playbooks/roles/bifrost-ironic-install/tasks/install.yml index afc43e1fc..eef7e395f 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/install.yml @@ -18,25 +18,28 @@ when: ansible_os_family == 'Debian' - block: - - name: "Enable powertools repository for CentOS Stream 8" + - name: "Enable powertools repository for EL8" 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 + when: ansible_distribution_version|int == 8 -- name: "Enable EPEL repository for CentOS Stream 9" + - name: "Enable crb repository for EL9" + command: dnf config-manager --set-enabled crb + when: ansible_distribution_version|int == 9 + + - name: "Enable EPEL repository for EL7/8/9" + ansible.builtin.dnf: + name: epel-release + when: + - enable_epel | bool + - ansible_distribution in ["AlmaLinux", "CentOS", "Rocky"] + +- name: "Enable EPEL repository for RedHat 9" command: dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm args: creates: /etc/yum.repos.d/epel.repo when: - enable_epel | bool - - dib_os_element == "debian" - - ansible_distribution == "CentOS" + - ansible_distribution == "RedHat" - ansible_distribution_version|int >= 9 - name: "Install packages" @@ -81,16 +84,6 @@ state: present 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: