# 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 $mirrorurl, String $secureurl, ) { $codename = $facts['os']['distro']['codename'] # Join the array into a space-separated string $repo_components = join($components, ' ') if 'base' in $managed_repos { apt::source { 'base': location => $mirrorurl, repos => $repo_components, release => $codename, } } if 'security' in $managed_repos { apt::source { 'security': location => $secureurl, repos => $repo_components, release => "${codename}-security", } } if 'updates' in $managed_repos { apt::source { 'updates': location => $mirrorurl, repos => $repo_components, release => "${codename}-updates", } } if 'backports' in $managed_repos { apt::source { 'backports': location => $mirrorurl, repos => $repo_components, release => "${codename}-backports", } } }