fix: yumrepo purging

This commit is contained in:
Ben Vincent 2024-06-14 23:48:05 +10:00
parent 380bb7bcb5
commit 67f831edaf
3 changed files with 18 additions and 10 deletions

View File

@ -19,45 +19,53 @@ profiles::yum::global::repos:
target: /etc/yum.repos.d/baseos.repo target: /etc/yum.repos.d/baseos.repo
baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/BaseOS/%{facts.os.architecture}/os baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/BaseOS/%{facts.os.architecture}/os
gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major} gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
mirrorlist: absent
extras: extras:
name: extras name: extras
descr: extras repository descr: extras repository
target: /etc/yum.repos.d/extras.repo target: /etc/yum.repos.d/extras.repo
baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/extras/%{facts.os.architecture}/os baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/extras/%{facts.os.architecture}/os
gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major} gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
mirrorlist: absent
appstream: appstream:
name: appstream name: appstream
descr: appstream repository descr: appstream repository
target: /etc/yum.repos.d/appstream.repo target: /etc/yum.repos.d/appstream.repo
baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/AppStream/%{facts.os.architecture}/os baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/AppStream/%{facts.os.architecture}/os
gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major} gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
mirrorlist: absent
powertools: powertools:
name: powertools name: powertools
descr: powertools repository descr: powertools repository
target: /etc/yum.repos.d/powertools.repo target: /etc/yum.repos.d/powertools.repo
baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/PowerTools/%{facts.os.architecture}/os baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/PowerTools/%{facts.os.architecture}/os
gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major} gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
mirrorlist: absent
highavailability: highavailability:
name: highavailability name: highavailability
descr: highavailability repository descr: highavailability repository
target: /etc/yum.repos.d/highavailability.repo target: /etc/yum.repos.d/highavailability.repo
baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/HighAvailability/%{facts.os.architecture}/os baseurl: https://edgecache.query.consul/almalinux/%{facts.os.release.full}/HighAvailability/%{facts.os.architecture}/os
gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major} gpgkey: http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
mirrorlist: absent
epel: epel:
name: epel name: epel
descr: epel repository descr: epel repository
target: /etc/yum.repos.d/epel.repo target: /etc/yum.repos.d/epel.repo
baseurl: https://edgecache.query.consul/epel/%{facts.os.release.major}/Everything/%{facts.os.architecture} baseurl: https://edgecache.query.consul/epel/%{facts.os.release.major}/Everything/%{facts.os.architecture}
gpgkey: http://edgecache.query.consul/epel/RPM-GPG-KEY-EPEL-%{facts.os.release.major} gpgkey: http://edgecache.query.consul/epel/RPM-GPG-KEY-EPEL-%{facts.os.release.major}
mirrorlist: absent
puppet: puppet:
name: puppet name: puppet
descr: puppet repository descr: puppet repository
target: /etc/yum.repos.d/puppet.repo target: /etc/yum.repos.d/puppet.repo
baseurl: https://yum.puppet.com/puppet7/el/%{facts.os.release.major}/%{facts.os.architecture} baseurl: https://yum.puppet.com/puppet7/el/%{facts.os.release.major}/%{facts.os.architecture}
gpgkey: https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406 gpgkey: https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406
mirrorlist: absent
unkin: unkin:
name: unkin name: unkin
descr: unkin repository descr: unkin repository
target: /etc/yum.repos.d/unkin.repo target: /etc/yum.repos.d/unkin.repo
baseurl: https://git.query.consul/api/packages/unkinben/rpm/el%{facts.os.release.major} baseurl: https://git.query.consul/api/packages/unkinben/rpm/el%{facts.os.release.major}
gpgkey: https://git.query.consul/api/packages/unkinben/rpm/repository.key gpgkey: https://git.query.consul/api/packages/unkinben/rpm/repository.key
mirrorlist: absent

View File

@ -34,7 +34,6 @@ class profiles::defaults {
ensure => 'present', ensure => 'present',
enabled => 1, enabled => 1,
gpgcheck => 1, gpgcheck => 1,
mirrorlist => 'absent',
require => Class['profiles::pki::vaultca'], require => Class['profiles::pki::vaultca'],
notify => Exec['dnf_makecache'], notify => Exec['dnf_makecache'],
} }

View File

@ -16,12 +16,12 @@ class profiles::yum::global (
purge => $purge, purge => $purge,
} }
exec {'purge_almalinux_default_repos': #exec {'purge_almalinux_default_repos':
command => 'rm -f /etc/yum.repos.d/almalinux*.repo', # command => 'rm -f /etc/yum.repos.d/almalinux*.repo',
path => ['/bin', '/usr/bin'], # path => ['/bin', '/usr/bin'],
onlyif => 'find /etc/yum.repos.d/ -type f -name *almalinux* | grep .', # onlyif => 'find /etc/yum.repos.d/ -type f -name *almalinux* | grep .',
before => Resources['yumrepo'], # before => Resources['yumrepo'],
} #}
# download all gpg keys if a repo defines it # download all gpg keys if a repo defines it
$repos.each |$name, $repo| { $repos.each |$name, $repo| {
@ -36,11 +36,12 @@ class profiles::yum::global (
before => Yumrepo[$name], before => Yumrepo[$name],
} }
} }
# create the repo
yumrepo { $name:
* => $repo,
}
} }
# create repos
create_resources('yumrepo', $repos)
# makecache if changes made to repos # makecache if changes made to repos
exec {'dnf_makecache': exec {'dnf_makecache':
command => 'dnf makecache -q', command => 'dnf makecache -q',