* manage all base repositories * manage epel if required * cleanup /etc/yum.repos.d directory
68 lines
2.1 KiB
Puppet
68 lines
2.1 KiB
Puppet
# Class: profile::yum::base
|
|
#
|
|
# This class manages the 'base', extras' and 'appstream' yum
|
|
# repositories for a system, based on the provided list of managed repositories.
|
|
#
|
|
# Parameters:
|
|
# -----------
|
|
# - $managed_repos: An array containing the names of the repositories to be
|
|
# managed. This can include 'base', 'extras',
|
|
# and 'appstream'.
|
|
#
|
|
# - $baseurl: The base URL for the yum repositories. This should be the root
|
|
# URL of your yum mirror server.
|
|
#
|
|
# Actions:
|
|
# --------
|
|
# - Sets up the 'base', extras', and 'appstream' yum repositories
|
|
# as specified in the $managed_repos parameter, all using the provided baseurl.
|
|
#
|
|
# - Each 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:
|
|
# class { 'profile::yum::base':
|
|
# managed_repos => ['base', 'extras', 'appstream'],
|
|
# baseurl => 'http://mylocalmirror.com/yum',
|
|
# }
|
|
#
|
|
class profile::yum::base (
|
|
Array[String] $managed_repos,
|
|
String $baseurl,
|
|
) {
|
|
$releasever = $facts['os']['release']['major']
|
|
$basearch = $facts['os']['architecture']
|
|
|
|
if 'base' in $managed_repos {
|
|
yumrepo { 'base':
|
|
name => 'base',
|
|
descr => 'base repository',
|
|
target => '/etc/yum.repos.d/base.repo',
|
|
baseurl => "${baseurl}/${releasever}/BaseOS/${basearch}/os/",
|
|
gpgkey => "${baseurl}/RPM-GPG-KEY-${facts['os']['name']}",
|
|
}
|
|
}
|
|
|
|
if 'extras' in $managed_repos {
|
|
yumrepo { 'extras':
|
|
name => 'extras',
|
|
descr => 'extras repository',
|
|
target => '/etc/yum.repos.d/extras.repo',
|
|
baseurl => "${baseurl}/${releasever}/extras/${basearch}/os/",
|
|
gpgkey => "${baseurl}/RPM-GPG-KEY-${facts['os']['name']}",
|
|
}
|
|
}
|
|
|
|
if 'appstream' in $managed_repos {
|
|
yumrepo { 'appstream':
|
|
name => 'appstream',
|
|
descr => 'appstream repository',
|
|
target => '/etc/yum.repos.d/appstream.repo',
|
|
baseurl => "${baseurl}/${releasever}/AppStream/${basearch}/os/",
|
|
gpgkey => "${baseurl}/RPM-GPG-KEY-${facts['os']['name']}",
|
|
}
|
|
}
|
|
}
|