From 500eba3634aa08e31095e06b1bcce0075f3e2b26 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 16 Sep 2022 10:32:29 +1000 Subject: [PATCH] configure-mirrors: make each compontent in 9-stream configurable When we added 9-stream with I2da3a5e8a45598c6b3ded132ea61b86b4480e262 we had some components pointing to the mirrors and some not. This is basically because the OpenDev mirrors choose to mirror these parts of the distribution. It was an oversight to do things like this, as this is nominally a generic configuration tool. This proposes that we put each component behind a variable which can be enabled or disabled. This way users of the role can switch on-or-off whatever their local mirrors carry, and fall-back to the generic mirror metalink in other cases. I imagine that with future distros like this we would have everything disabled by default in zuul-jobs, and leave it up to sites to explicitly opt-in the various components. We could announce this via our usual deprecation path and do similar for 9-stream; but for now this keeps the defaults as it is currently written. Change-Id: Ibfd88c137855c22b960099cc8d582b241c3b1db6 --- roles/configure-mirrors/README.rst | 8 +++ .../etc/yum.repos.d/centos-addons.repo.j2 | 56 +++++++++++++++++++ .../etc/yum.repos.d/centos.repo.j2 | 36 ++++++++++++ roles/configure-mirrors/vars/CentOS-9.yaml | 25 +++++++++ 4 files changed, 125 insertions(+) diff --git a/roles/configure-mirrors/README.rst b/roles/configure-mirrors/README.rst index 339219cb4..fd153cf4d 100644 --- a/roles/configure-mirrors/README.rst +++ b/roles/configure-mirrors/README.rst @@ -48,3 +48,11 @@ An ansible role to configure services to use mirrors. role is not necessarily consistent with the repos that are enabled by default between distribution versions (centos stream 8 vs. 9 for example). + +.. zuul:rolevar:: configure_mirrors_components_9_stream + :default: See `vars/CentOS-9.yaml` + + A list of the components that should be redirected to the + `mirror_fqdn` when setting up a CentOS 9-stream host. For example, + your mirror may only mirror some components, or not the + debug/source components, etc. diff --git a/roles/configure-mirrors/templates/centos9-stream/etc/yum.repos.d/centos-addons.repo.j2 b/roles/configure-mirrors/templates/centos9-stream/etc/yum.repos.d/centos-addons.repo.j2 index efc6ab31f..feb59d17b 100644 --- a/roles/configure-mirrors/templates/centos9-stream/etc/yum.repos.d/centos-addons.repo.j2 +++ b/roles/configure-mirrors/templates/centos9-stream/etc/yum.repos.d/centos-addons.repo.j2 @@ -1,6 +1,10 @@ [highavailability] name=CentOS Stream $releasever - HighAvailability +{% if configure_mirrors_components_9_stream['highavailability'] %} baseurl={{ package_mirror }}/$stream/HighAvailability/$basearch/os/ +{% else %} +metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -10,7 +14,11 @@ enabled=0 [highavailability-debug] name=CentOS Stream $releasever - HighAvailability - Debug +{% if configure_mirrors_components_9_stream['highavailability-debug'] %} +baseurl={{ package_mirror }}/$stream/HighAvailability/%basearch/debug/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -19,7 +27,11 @@ enabled=0 [highavailability-source] name=CentOS Stream $releasever - HighAvailability - Source +{% if configure_mirrors_components_9_stream['highavailability-source'] %} +baseurl={{ package_mirror }}/$stream/HighAvailability/%basearch/source/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -28,7 +40,11 @@ enabled=0 [nfv] name=CentOS Stream $releasever - NFV +{% if configure_mirrors_components_9_stream['nfv'] %} baseurl={{ package_mirror }}/$stream/NFV/$basearch/os/ +{% else %} +metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -38,7 +54,11 @@ enabled=0 [nfv-debug] name=CentOS Stream $releasever - NFV - Debug +{% if configure_mirrors_components_9_stream['nfv-debug'] %} +baseurl={{ package_mirror }}/$stream/NFV/$basearch/debug/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -47,7 +67,11 @@ enabled=0 [nfv-source] name=CentOS Stream $releasever - NFV - Source +{% if configure_mirrors_components_9_stream['nfv-source'] %} +baseurl={{ package_mirror }}/$stream/NFV/$basearch/debug/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -56,7 +80,11 @@ enabled=0 [rt] name=CentOS Stream $releasever - RT +{% if configure_mirrors_components_9_stream['rt'] %} baseurl={{ package_mirror }}/$stream/RT/$basearch/os/ +{% else %} +metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -66,7 +94,11 @@ enabled=0 [rt-debug] name=CentOS Stream $releasever - RT - Debug +{% if configure_mirrors_components_9_stream['rt-debug'] %} +baseurl={{ package_mirror }}/$stream/RT/$basearch/debug/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -75,7 +107,11 @@ enabled=0 [rt-source] name=CentOS Stream $releasever - RT - Source +{% if configure_mirrors_components_9_stream['rt-source'] %} +baseurl={{ package_mirror }}/$stream/RT/$basearch/source/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -84,7 +120,11 @@ enabled=0 [resilientstorage] name=CentOS Stream $releasever - ResilientStorage +{% if configure_mirrors_components_9_stream['resilientstorage'] %} baseurl={{ package_mirror }}/$stream/ResilientStorage/$basearch/os/ +{% else %} +metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -94,7 +134,11 @@ enabled=0 [resilientstorage-debug] name=CentOS Stream $releasever - ResilientStorage - Debug +{% if configure_mirrors_components_9_stream['resilientstorage-debug'] %} +baseurl={{ package_mirror }}/$stream/ResilientStorage/$basearch/debug/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -103,7 +147,11 @@ enabled=0 [resilientstorage-source] name=CentOS Stream $releasever - ResilientStorage - Source +{% if configure_mirrors_components_9_stream['resilientstorage-source'] %} +baseurl={{ package_mirror }}/$stream/ResilientStorage/$basearch/source/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -112,7 +160,11 @@ enabled=0 [extras-common] name=CentOS Stream $releasever - Extras packages +{% if configure_mirrors_components_9_stream['extras-common'] %} metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http +{% else %} +baseurl={{ package_mirror }}/SIGs/$stream/extras/$basearch/extras-common/ +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 @@ -122,7 +174,11 @@ enabled=1 [extras-common-source] name=CentOS Stream $releasever - Extras packages - Source +{% if configure_mirrors_components_9_stream['extras-common'] %} +baseurl={{ package_mirror }}/SIGs/$stream/extras/source/extras-common/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 diff --git a/roles/configure-mirrors/templates/centos9-stream/etc/yum.repos.d/centos.repo.j2 b/roles/configure-mirrors/templates/centos9-stream/etc/yum.repos.d/centos.repo.j2 index 7481d2890..8b446acb0 100644 --- a/roles/configure-mirrors/templates/centos9-stream/etc/yum.repos.d/centos.repo.j2 +++ b/roles/configure-mirrors/templates/centos9-stream/etc/yum.repos.d/centos.repo.j2 @@ -1,7 +1,11 @@ # {{ ansible_managed }} [baseos] name=CentOS Stream $releasever - BaseOS +{% if configure_mirrors_components_9_stream['baseos'] %} baseurl={{ package_mirror }}/$stream/BaseOS/$basearch/os/ +{% else %} +metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -11,7 +15,11 @@ enabled=1 [baseos-debug] name=CentOS Stream $releasever - BaseOS - Debug +{% if configure_mirrors_components_9_stream['baseos-debug'] %} +baseurl={{ package_mirror }}/$stream/BaseOS/$basearch/debug/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -20,7 +28,11 @@ enabled=0 [baseos-source] name=CentOS Stream $releasever - BaseOS - Source +{% if configure_mirrors_components_9_stream['baseos-source'] %} +baseurl={{ package_mirror }}/$stream/BaseOS/$basearch/source/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -29,7 +41,11 @@ enabled=0 [appstream] name=CentOS Stream $releasever - AppStream +{% if configure_mirrors_components_9_stream['appstream'] %} baseurl={{ package_mirror }}/$stream/AppStream/$basearch/os/ +{% else %} +metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -39,7 +55,11 @@ enabled=1 [appstream-debug] name=CentOS Stream $releasever - AppStream - Debug +{% if configure_mirrors_components_9_stream['appstream-debug'] %} +baseurl={{ package_mirror }}/$stream/AppStream/$basearch/debug/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -48,7 +68,11 @@ enabled=0 [appstream-source] name=CentOS Stream $releasever - AppStream - Source +{% if configure_mirrors_components_9_stream['appstream-source'] %} +baseurl={{ package_mirror }}/$stream/AppStream/$basearch/source/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -57,7 +81,11 @@ enabled=0 [crb] name=CentOS Stream $releasever - CRB +{% if configure_mirrors_components_9_stream['crb'] %} baseurl={{ package_mirror }}/$stream/CRB/$basearch/os/ +{% else %} +metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -67,7 +95,11 @@ enabled=1 [crb-debug] name=CentOS Stream $releasever - CRB - Debug +{% if configure_mirrors_components_9_stream['crb-debug'] %} +baseurl={{ package_mirror }}/$stream/CRB/$basearch/debug/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 @@ -76,7 +108,11 @@ enabled=0 [crb-source] name=CentOS Stream $releasever - CRB - Source +{% if configure_mirrors_components_9_stream['crb-source'] %} +baseurl={{ package_mirror }}/$stream/CRB/$basearch/source/ +{% else %} metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http +{% endif %} gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 diff --git a/roles/configure-mirrors/vars/CentOS-9.yaml b/roles/configure-mirrors/vars/CentOS-9.yaml index bf53ea80f..5002f44b4 100644 --- a/roles/configure-mirrors/vars/CentOS-9.yaml +++ b/roles/configure-mirrors/vars/CentOS-9.yaml @@ -1,3 +1,28 @@ package_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}-stream" epel_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/epel" wheel_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture | lower }}" + +configure_mirrors_components_9_stream: + 'baseos': true + 'baseos-debug': false + 'baseos-source': false + 'appstream': true + 'appstream-debug': false + 'appstream-source': false + 'crb': true + 'crb-debug': false + 'crb-source': false + 'highavailability': true + 'highavailability-debug': false + 'highavailability-source': false + 'nfv': true + 'nfv-debug': true + 'nfv-source': false + 'rt': true + 'rt-debug': false + 'rt-source': false + 'resilientstorage': true + 'resilientstorage-debug': false + 'resilientstorage-source': false + 'extras-common': false + 'extras-common-source': false