* this removes the need to manually download/store the file, then
pass it to the dpkg package manager
61 lines
1.9 KiB
Puppet
61 lines
1.9 KiB
Puppet
# This class manages the installation and configuration of Puppet 7
|
|
#
|
|
# Parameters:
|
|
# - $managed_repos: An array of additional repositories to manage (optional)
|
|
# - $mirror: The base URL of the repository mirror
|
|
# - $repo: The repository name
|
|
# - $release: The release name
|
|
#
|
|
# Dependencies:
|
|
# - Puppet facts: The class relies on certain facts about the target system,
|
|
# including the OS release, architecture, and distribution codename.
|
|
#
|
|
# Description:
|
|
# This class installs Puppet 7 on the target system by managing the repository
|
|
# configuration and installing the appropriate package. It also supports the
|
|
# management of additional repositories specified in the $managed_repos parameter.
|
|
# The class retrieves necessary information from Puppet facts, such as the OS
|
|
# release version, architecture, and distribution codename. It downloads the
|
|
# Puppet release deb file from the specified mirror and installs it using dpkg.
|
|
# Additionally, it configures the main Puppet repository using the apt::source resource.
|
|
#
|
|
# Example usage:
|
|
# class { 'profiles::apt::puppet7':
|
|
# managed_repos => ['extra-repo'],
|
|
# mirror => 'http://mirror.example.com',
|
|
# release => 'puppet7',
|
|
# repo => 'bullseye',
|
|
# }
|
|
class profiles::apt::puppet7 (
|
|
Array[String] $managed_repos,
|
|
String $mirror,
|
|
String $repo,
|
|
String $dist,
|
|
) {
|
|
|
|
$codename = $facts['os']['distro']['codename']
|
|
|
|
if 'puppet7' in $managed_repos {
|
|
$puppet_source = "${mirror}/${repo}-release-${dist}.deb"
|
|
|
|
# Install the puppet release using dpkg
|
|
package { "${repo}-${dist}":
|
|
ensure => installed,
|
|
name => "${repo}-release",
|
|
provider => dpkg,
|
|
source => $puppet_source,
|
|
}
|
|
|
|
# deb http://apt.puppet.com bullseye puppet7
|
|
apt::source { 'puppet7':
|
|
location => $mirror,
|
|
repos => $repo,
|
|
release => $dist,
|
|
include => {
|
|
'src' => false,
|
|
'deb' => true,
|
|
},
|
|
}
|
|
}
|
|
}
|