From 8a6b3ef0fb299124fa1e316efbdb7842465a4c36 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sat, 2 Dec 2023 23:45:35 +1100 Subject: [PATCH] feat: add mirrorlist capability to reposyncer - add mirrorlist param to reposyncer repos - update almalinux 8.8 repos to use mirrorlist - add almalinux 8.9 repos --- hieradata/roles/infra/reposync/syncer.yaml | 48 +++++++++++++++++++--- site/profiles/manifests/reposync/repos.pp | 22 ++++++---- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/hieradata/roles/infra/reposync/syncer.yaml b/hieradata/roles/infra/reposync/syncer.yaml index d76231e..e6a341e 100644 --- a/hieradata/roles/infra/reposync/syncer.yaml +++ b/hieradata/roles/infra/reposync/syncer.yaml @@ -5,42 +5,78 @@ profiles::reposync::repos_list: description: 'AlmaLinux 8.8 - BaseOS' osname: 'almalinux' release: '8.8' - baseurl: 'http://mirror.aarnet.edu.au/pub/almalinux/8.8/BaseOS/x86_64/os/' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.8/baseos gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' almalinux_8_8_appstream: repository: 'AppStream' description: 'AlmaLinux 8.8 - AppStream' osname: 'almalinux' release: '8.8' - baseurl: 'http://mirror.aarnet.edu.au/pub/almalinux/8.8/AppStream/x86_64/os/' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.8/appstream gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' almalinux_8_8_highavailability: repository: 'HighAvailability' description: 'AlmaLinux 8.8 - HighAvailability' osname: 'almalinux' release: '8.8' - baseurl: 'http://mirror.aarnet.edu.au/pub/almalinux/8.8/HighAvailability/x86_64/os/' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.8/ha gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' almalinux_8_8_powertools: repository: 'PowerTools' description: 'AlmaLinux 8.8 - PowerTools' osname: 'almalinux' release: '8.8' - baseurl: 'http://mirror.aarnet.edu.au/pub/almalinux/8.8/PowerTools/x86_64/os/' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.8/powertools gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' almalinux_8_8_extras: repository: 'extras' description: 'AlmaLinux 8.8 - extras' osname: 'almalinux' release: '8.8' - baseurl: 'http://mirror.aarnet.edu.au/pub/almalinux/8.8/extras/x86_64/os/' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.8/extras + gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' + almalinux_8_9_baseos: + repository: 'BaseOS' + description: 'AlmaLinux 8.9 - BaseOS' + osname: 'almalinux' + release: '8.9' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.9/baseos + gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' + almalinux_8_9_appstream: + repository: 'AppStream' + description: 'AlmaLinux 8.9 - AppStream' + osname: 'almalinux' + release: '8.9' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.9/appstream + gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' + almalinux_8_9_highavailability: + repository: 'HighAvailability' + description: 'AlmaLinux 8.9 - HighAvailability' + osname: 'almalinux' + release: '8.9' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.9/ha + gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' + almalinux_8_9_powertools: + repository: 'PowerTools' + description: 'AlmaLinux 8.9 - PowerTools' + osname: 'almalinux' + release: '8.9' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.9/powertools + gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' + almalinux_8_9_extras: + repository: 'extras' + description: 'AlmaLinux 8.9 - extras' + osname: 'almalinux' + release: '8.9' + mirrorlist: https://mirrors.almalinux.org/mirrorlist/8.9/extras gpgkey: 'http://mirror.aarnet.edu.au/pub/almalinux/RPM-GPG-KEY-AlmaLinux' epel_8_everything: repository: 'Everything' description: 'EPEL 8 Everything' osname: 'epel' release: '8' - baseurl: 'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/' + # baseurl: 'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/' + mirrorlist: 'https://mirrors.fedoraproject.org/mirrorlist?repo=epel-8&arch=x86_64' gpgkey: 'https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' mariadb_11_2_el8: repository: 'el8' diff --git a/site/profiles/manifests/reposync/repos.pp b/site/profiles/manifests/reposync/repos.pp index 5886785..046e404 100644 --- a/site/profiles/manifests/reposync/repos.pp +++ b/site/profiles/manifests/reposync/repos.pp @@ -4,26 +4,32 @@ define profiles::reposync::repos ( String $description, String $osname, String $release, - Stdlib::HTTPUrl $baseurl, Stdlib::HTTPUrl $gpgkey, String $arch = 'x86_64', String $repo_owner = 'root', String $repo_group = 'root', Stdlib::Absolutepath $basepath = '/data/repos', + Optional[Stdlib::HTTPUrl] $baseurl = undef, + Optional[Stdlib::HTTPUrl] $mirrorlist = undef, ){ + if ($mirrorlist == undef and $baseurl == undef) or ($mirrorlist != undef and $baseurl != undef) { + fail('profiles::reposync::repos must have either mirrorlist or baseurl set, but not both') + } + $repos_name = downcase("${osname}-${release}-${repository}-${arch}") $conf_file = "/etc/reposync/conf.d/${repos_name}.conf" # Create the repository configuration yumrepo { $repos_name: - ensure => 'present', - descr => $description, - baseurl => $baseurl, - gpgkey => $gpgkey, - target => '/etc/yum.repos.d/reposync.repo', - enabled => 0, - gpgcheck => 1, + ensure => 'present', + descr => $description, + baseurl => $baseurl, + mirrorlist => $mirrorlist, + gpgkey => $gpgkey, + target => '/etc/yum.repos.d/reposync.repo', + enabled => 0, + gpgcheck => 1, } # Ensure the repo dest path exists