From 7105b2520ecdc444719d0d60d0d307f0ff825f50 Mon Sep 17 00:00:00 2001 From: Nick Dokos Date: Tue, 19 Jul 2022 14:31:30 -0400 Subject: [PATCH] Use the "epel" chroot for "Rocky Linux" PBENCH-834 Set up a map with the `ansible_distribution' value as key and the COPR chroot name as value. Use the map to calculate the final component of the baseurl field in the repo file (except for CentOS 7 which is reporting "CentOS" for the ansible_distribution value but it requires the "epel" chroot). The map can be extended easily for other distros ( RHEL clones or otherwise). --- .../roles/pbench_repo_install/vars/main.yml | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/agent/ansible/pbench/agent/roles/pbench_repo_install/vars/main.yml b/agent/ansible/pbench/agent/roles/pbench_repo_install/vars/main.yml index 71ab5853f7..31d2acd1d4 100644 --- a/agent/ansible/pbench/agent/roles/pbench_repo_install/vars/main.yml +++ b/agent/ansible/pbench/agent/roles/pbench_repo_install/vars/main.yml @@ -1,9 +1,13 @@ --- -distro: "{{ 'centos-stream' if ansible_distribution == 'CentOS' and ansible_distribution_major_version > '7' - else - 'epel' if ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS' - else - 'fedora' if ansible_distribution == 'Fedora' - else - '' }}" -distrodir: "{{ distro }}-{{ ansible_distribution_major_version }}-$basearch" +# Map distribution name to COPR chroot +copr_chroots: + RedHat: epel + Fedora: fedora + CentOS: centos-stream + Rocky: epel + +# CentOS 7 is an exception +copr_distro: "{{ 'epel' if ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' + else + copr_chroots[ansible_distribution] }}" +distrodir: "{{ copr_distro }}-{{ ansible_distribution_major_version }}-$basearch"