feat: split agent service/package from config
- split package/service from config so puppetservers agents can be managed in the same was as clients
This commit is contained in:
parent
caffc7dff9
commit
08c14c2329
@ -6,4 +6,4 @@ profiles::firewall::firewalld::ensure_package: 'absent'
|
||||
profiles::firewall::firewalld::ensure_service: 'stopped'
|
||||
profiles::firewall::firewalld::enable_service: false
|
||||
|
||||
profiles::puppet::client::puppet_version: '7.26.0'
|
||||
profiles::puppet::agent::puppet_version: '7.26.0'
|
||||
|
||||
@ -11,4 +11,4 @@ profiles::apt::components:
|
||||
- main
|
||||
- non-free
|
||||
|
||||
profiles::puppet::client::puppet_version: '7.25.0-1bullseye'
|
||||
profiles::puppet::agent::puppet_version: '7.25.0-1bullseye'
|
||||
|
||||
@ -12,4 +12,4 @@ profiles::apt::components:
|
||||
- non-free
|
||||
- non-free-firmware
|
||||
|
||||
profiles::puppet::client::puppet_version: 'latest'
|
||||
profiles::puppet::agent::puppet_version: 'latest'
|
||||
|
||||
@ -16,6 +16,9 @@ class profiles::base (
|
||||
}
|
||||
}
|
||||
|
||||
# manage the puppet agent
|
||||
include profiles::puppet::agent
|
||||
|
||||
# manage puppet clients
|
||||
if ! member($puppet_servers, $trusted['certname']) {
|
||||
include profiles::puppet::client
|
||||
|
||||
35
site/profiles/manifests/puppet/agent.pp
Normal file
35
site/profiles/manifests/puppet/agent.pp
Normal file
@ -0,0 +1,35 @@
|
||||
# profiles::puppet::agent
|
||||
# This class manages Puppet agent package and service.
|
||||
class profiles::puppet::agent (
|
||||
String $puppet_version = 'latest',
|
||||
) {
|
||||
|
||||
# Ensure the puppet-agent package is installed and locked to a specific version
|
||||
package { 'puppet-agent':
|
||||
ensure => $puppet_version,
|
||||
}
|
||||
|
||||
# if puppet-version is anything other than latest, set a versionlock
|
||||
$puppet_versionlock_ensure = $puppet_version ? {
|
||||
'latest' => 'absent',
|
||||
default => 'present',
|
||||
}
|
||||
$puppet_versionlock_version = $puppet_version ? {
|
||||
'latest' => undef,
|
||||
default => $puppet_version,
|
||||
}
|
||||
yum::versionlock{'puppet-agent':
|
||||
ensure => $puppet_versionlock_ensure,
|
||||
version => $puppet_versionlock_version,
|
||||
}
|
||||
|
||||
# Ensure the puppet service is running
|
||||
service { 'puppet':
|
||||
ensure => 'running',
|
||||
enable => true,
|
||||
hasrestart => true,
|
||||
require => Package['puppet-agent'],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,6 @@
|
||||
# Class: profiles::puppet::client
|
||||
#
|
||||
# This class manages Puppet client configuration and service.
|
||||
#
|
||||
# Parameters:
|
||||
# vardir - Directory path for variable data.
|
||||
# logdir - Directory path for logs.
|
||||
# rundir - Directory path for run-time data.
|
||||
# pidfile - File path for the PID file.
|
||||
# codedir - Directory path for code data.
|
||||
# dns_alt_names - Array of alternate DNS names for the server.
|
||||
# server - Server's name.
|
||||
# This class manages Puppet client configuration.
|
||||
#
|
||||
# site/profile/manifests/puppet/client.pp
|
||||
class profiles::puppet::client (
|
||||
@ -21,36 +12,8 @@ class profiles::puppet::client (
|
||||
Integer $runtimeout = 3600,
|
||||
Boolean $show_diff = true,
|
||||
Boolean $usecacheonfailure = false,
|
||||
String $puppet_version = 'latest',
|
||||
) {
|
||||
|
||||
# Ensure the puppet-agent package is installed and locked to a specific version
|
||||
package { 'puppet-agent':
|
||||
ensure => $puppet_version,
|
||||
}
|
||||
|
||||
# if puppet-version is anything other than latest, set a versionlock
|
||||
$puppet_versionlock_ensure = $puppet_version ? {
|
||||
'latest' => 'absent',
|
||||
default => 'present',
|
||||
}
|
||||
$puppet_versionlock_version = $puppet_version ? {
|
||||
'latest' => undef,
|
||||
default => $puppet_version,
|
||||
}
|
||||
yum::versionlock{'puppet-agent':
|
||||
ensure => $puppet_versionlock_ensure,
|
||||
version => $puppet_versionlock_version,
|
||||
}
|
||||
|
||||
# Ensure the puppet service is running
|
||||
service { 'puppet':
|
||||
ensure => 'running',
|
||||
enable => true,
|
||||
hasrestart => true,
|
||||
require => Package['puppet-agent'],
|
||||
}
|
||||
|
||||
# Assuming you want to manage puppet.conf with this profile
|
||||
file { '/etc/puppetlabs/puppet/puppet.conf':
|
||||
ensure => 'present',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user