puppet-prod/site/profile/manifests/yum/epel.pp
Ben Vincent 87d9d920e8 Added classes to manage repositories for yum
* manage all base repositories
  * manage epel if required
  * cleanup /etc/yum.repos.d directory
2023-06-24 21:58:00 +10:00

58 lines
1.6 KiB
Puppet

# Class: profile::yum::epel
#
# This class manages the EPEL yum repository for the system.
#
# Parameters:
# -----------
# - $baseurl: The base URL for the EPEL yum repository. This should be the root
# URL of your EPEL mirror server.
#
# Actions:
# --------
# - Checks the OS release version.
#
# - If the release version is 7, 8, or 9, it sets up the 'epel' yum repository
# and installs the EPEL release RPM from the provided baseurl.
#
# - If the release version is not supported, it raises an error.
#
# - The repo configuration includes the baseurl parameterized with the OS
# release version and architecture, and specifies the GPG key.
#
# Example usage:
# --------------
# To use this class with the default parameters:
# include profile::yum::epel
#
# To specify a custom base URL:
# class { 'profile::yum::epel':
# baseurl => 'http://mylocalmirror.com/yum',
# }
class profile::yum::epel (
Array[String] $managed_repos,
String $baseurl,
) {
$releasever = $facts['os']['release']['major']
$basearch = $facts['os']['architecture']
if 'epel' in $managed_repos {
if ($releasever in [7,8,9]) {
$source = "${baseurl}/epel-release-latest-${releasever}.noarch.rpm"
yum::install { 'epel-release':
ensure => present,
source => $source,
}
} else {
err("Unsupported OS release ${releasever}")
}
yumrepo { 'epel':
name => 'epel',
descr => 'epel repository',
target => '/etc/yum.repos.d/epel.repo',
baseurl => "${baseurl}/${releasever}/Everything/${basearch}/",
gpgkey => "${baseurl}/RPM-GPG-KEY-EPEL-${releasever}",
}
}
}