puppet-prod/site/profiles/manifests/apt/global.pp
Ben Vincent 87f174df33 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
2023-07-01 22:38:25 +10:00

71 lines
2.2 KiB
Puppet

# Class: profiles::apt::global
#
# This class manages global APT configurations and optionally includes the
# base and Puppet7 apt repository profiles. The profiles included are based on
# the content of the $managed_repos parameter, which is an array of repository names.
#
# Parameters:
# -----------
# $managed_repos: An array of repository names that should be managed by Puppet agent.
# This parameter is mandatory and the class will fail if it is not provided via hieradata.
# Example: ['base', 'security', 'updates', 'backports']
#
# Actions:
# --------
# Configures global APT settings, including setting up the 'src' and 'deb' options for all
# repositories managed by Puppet.
# Establishes default parameters for any APT repositories managed by Puppet.
# These parameters include the repository description, the inclusion of 'src' and 'deb',
# and the pinning.
# Depending on the content of the $managed_repos parameter, it includes the
# profiles::apt::base and/or profiles::apt::puppet7 classes.
# Manages all .list files under /etc/apt/sources.list.d. All the repositories listed
# in $managed_repos will have their corresponding .list files preserved. Any
# .list file that is not listed in $managed_repos will be removed.
# Manages /etc/apt/sources.list file to be empty.
#
# Example usage:
# --------------
# To use this class, include it and configure hieradata:
# include profiles::apt::global
#
# profiles::apt::managed_repos:
# - 'base'
# - 'security'
# - 'updates'
# - 'backports'
class profiles::apt::global (
Array[String] $managed_repos = lookup('profiles::apt::managed_repos'),
Array[String] $components = lookup('profiles::apt::components'),
){
class { 'apt':
sources_list_force => true,
purge => {
'sources.list' => true,
'sources.list.d' => true,
},
update => {
frequency => 'daily',
loglevel => 'debug',
},
}
Apt::Source {
include => {
'src' => true,
'deb' => true,
},
}
# Setup base repos
class { 'profiles::apt::base':
managed_repos => $managed_repos,
components => $components,
}
# Setup puppet7 if included in managed_repos
class { 'profiles::apt::puppet7':
managed_repos => $managed_repos,
}
}