33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'manifests/init.pp', line 33
class bolt (
String[1] $version = 'installed',
Stdlib::HTTPSUrl $base_url = $facts['os']['family'] ? { 'Debian' => 'https://apt.puppet.com/', 'RedHat' => 'https://yum.puppet.com/', },
String[1] $release_package = $facts['os']['family'] ? { 'Debian' => "puppet-release-${fact('os.distro.codename')}.deb", 'RedHat' => "puppet-tools-release-el-${facts['os']['release']['major']}.noarch.rpm", },
String[1] $gpgkey = $facts['os']['family'] ? { 'Debian' => 'DEB-GPG-KEY-puppet-20250406', 'RedHat' => 'RPM-GPG-KEY-puppet-20250406', },
Boolean $use_release_package = $facts['os']['family'] ? { 'Debian' => false, 'RedHat' => true, },
Stdlib::HTTPSUrl $yumrepo_base_url = "${base_url}puppet-tools/el/${facts['os']['release']['major']}/\$basearch",
Boolean $manage_repo = true,
) {
unless $facts['os']['family'] in ['RedHat', 'Debian'] {
fail("class bolt only works on ${facts['os']['family']} OS family")
}
$ensure = $version ? {
'absent' => 'absent',
default => 'present',
}
if $manage_repo {
if $use_release_package {
package { 'puppet-tools-release':
ensure => $ensure,
source => "${base_url}${release_package}",
}
$require = Package['puppet-tools-release']
} else {
if $facts['os']['family'] == 'RedHat' {
yumrepo { 'puppet-tools':
ensure => $ensure,
baseurl => $yumrepo_base_url,
descr => "Puppet Tools Repository el ${facts['os']['release']['major']} - \$basearch",
enabled => '1',
gpgcheck => '1',
gpgkey => "${base_url}${gpgkey}",
}
$require = Yumrepo['puppet-tools']
} else {
apt::source { 'puppet-tools-release':
location => $base_url,
repos => 'puppet-tools',
before => Package['puppet-bolt'],
}
# the update class, according to puppetlabs/apt, needs to be called before the package resource
# https://github.com/puppetlabs/puppetlabs-apt?tab=readme-ov-file#adding-new-sources-or-ppas
$require = [Class['apt::update'], Apt::Source['puppet-tools-release']]
}
}
} else {
$require = undef
}
package { 'puppet-bolt':
ensure => $version,
require => $require,
}
}
|