All checks were successful
Build / precommit (pull_request) Successful in 4m20s
- add 30+ repository definitions to AlmaLinux/all_releases.yaml with `ensure: absent` defaults - update all role-specific hieradata files to use `ensure: present` pattern - remove duplicated repository URL/GPG key configurations from individual roles - maintains existing functionality while improving maintainability"
81 lines
2.5 KiB
Puppet
81 lines
2.5 KiB
Puppet
# profiles::puppet::agent
|
|
# This class manages Puppet agent package and service.
|
|
class profiles::puppet::agent (
|
|
String $version = 'latest',
|
|
Boolean $openvox_enable = false,
|
|
) {
|
|
|
|
# set openvox package, yumrepo, service
|
|
if $openvox_enable {
|
|
$use_package = 'openvox-agent'
|
|
$use_yumrepo = 'openvox'
|
|
$use_service = 'puppet'
|
|
}else{
|
|
$use_package = 'puppet-agent'
|
|
$use_yumrepo = 'puppet'
|
|
$use_service = 'puppet'
|
|
}
|
|
|
|
# manage the yumrepo for the given package
|
|
if $openvox_enable and $facts['os']['family'] == 'RedHat' {
|
|
yumrepo { 'openvox':
|
|
ensure => 'present',
|
|
baseurl => "https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/openvox/openvox7/el/${facts['os']['release']['major']}/${facts['os']['architecture']}/",
|
|
descr => 'openvox repository',
|
|
gpgkey => 'https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/openvox/GPG-KEY-openvox.pub',
|
|
notify => Exec['dnf_makecache'],
|
|
}
|
|
}else{
|
|
yumrepo { 'puppet':
|
|
ensure => 'present',
|
|
baseurl => "https://packagerepo.service.consul/puppet7/el/${facts['os']['release']['major']}-daily/${facts['os']['architecture']}/os/",
|
|
descr => 'puppet repository',
|
|
gpgkey => "https://packagerepo.service.consul/puppet7/el/${facts['os']['release']['major']}-daily/${facts['os']['architecture']}/os/RPM-GPG-KEY-puppet-20250406",
|
|
notify => Exec['dnf_makecache'],
|
|
}
|
|
}
|
|
|
|
# if agent-version is anything other than latest, set a versionlock
|
|
$agent_versionlock_ensure = $version ? {
|
|
'latest' => 'absent',
|
|
default => 'present',
|
|
}
|
|
$agent_versionlock_version = $version ? {
|
|
'latest' => undef,
|
|
default => $version,
|
|
}
|
|
|
|
case $facts['os']['family'] {
|
|
'RedHat': {
|
|
# Ensure the agent package is installed and locked to a specific version
|
|
package { $use_package:
|
|
ensure => $version,
|
|
require => Yumrepo[$use_yumrepo],
|
|
}
|
|
|
|
# versionlock puppet-agent
|
|
yum::versionlock{$use_package:
|
|
ensure => $agent_versionlock_ensure,
|
|
version => $agent_versionlock_version,
|
|
}
|
|
}
|
|
'Debian': {
|
|
# Ensure the puppet-agent package is installed and locked to a specific version
|
|
package { $use_package:
|
|
ensure => $version,
|
|
require => Class['profiles::apt::puppet7'],
|
|
}
|
|
}
|
|
default: {}
|
|
}
|
|
|
|
# Ensure the puppet service is running
|
|
service { $use_service:
|
|
ensure => 'running',
|
|
enable => true,
|
|
hasrestart => true,
|
|
require => Package[$use_package],
|
|
}
|
|
|
|
}
|