Added Debian components

* added debian components for Debian12 and Debian11
  * added apt module to puppetfile
  * removed /etc/apt/sources.list management, done by apt module
  * added profiles::apt::puppet7
This commit is contained in:
2023-06-29 22:10:25 +10:00
parent 46a95d756a
commit 87f174df33
7 changed files with 157 additions and 54 deletions
+54 -19
View File
@@ -1,36 +1,71 @@
# This class manages the configuration of base APT repositories
#
# Parameters:
# - $managed_repos: An array of repositories to manage, such as 'base', 'security',
# 'updates', 'backports' (optional)
# - $components: An array of components for the repositories (e.g., 'main', 'contrib')
# - $mirrorurl: The base URL of the mirror for the base repository
# - $secureurl: The base URL of the mirror for the security repository
#
# Dependencies:
# - Puppet facts: The class relies on certain facts about the target system,
# including the OS architecture and distribution codename.
#
# Description:
# This class manages the configuration of base APT repositories on the target system.
# It supports the management of repositories specified in the $managed_repos parameter,
# including 'base', 'security', 'updates', and 'backports'. The class retrieves necessary
# information from Puppet facts, such as the OS architecture and distribution codename.
# It creates apt::source resources for each repository, setting the appropriate location,
# repos, and release values based on the provided parameters.
#
# Example usage:
# class { 'profiles::apt::base':
# managed_repos => ['base', 'security'],
# components => ['main', 'contrib'],
# mirrorurl => 'http://mirror.example.com',
# secureurl => 'http://security.example.com',
# }
class profiles::apt::base (
Array[String] $managed_repos,
Array[String] $components,
String $baseurl,
String $mirrorurl,
String $secureurl,
) {
$releasever = $facts['os']['release']['major']
$basearch = $facts['os']['architecture']
$codename = $facts['os']['distro']['codename']
# Join the array into a space-separated string
$repo_components = join($components, ' ')
apt::source { "deb.debian.org-${codename}":
location => $baseurl,
repos => $repo_components,
release => $codename,
if 'base' in $managed_repos {
apt::source { 'base':
location => $mirrorurl,
repos => $repo_components,
release => $codename,
}
}
apt::source { "deb.debian.org-${codename}-security":
location => $baseurl,
repos => $repo_components,
release => "${codename}-security",
if 'security' in $managed_repos {
apt::source { 'security':
location => $secureurl,
repos => $repo_components,
release => "${codename}-security",
}
}
apt::source { "deb.debian.org-${codename}-updates":
location => $baseurl,
repos => $repo_components,
release => "${codename}-updates",
if 'updates' in $managed_repos {
apt::source { 'updates':
location => $mirrorurl,
repos => $repo_components,
release => "${codename}-updates",
}
}
apt::source { "deb.debian.org-${codename}-backports":
location => $baseurl,
repos => $repo_components,
release => "${codename}-backports",
if 'backports' in $managed_repos {
apt::source { 'backports':
location => $mirrorurl,
repos => $repo_components,
release => "${codename}-backports",
}
}
}