Skip to content

Commit e9fe279

Browse files
committed
P:puppet: add puppet-04 on bookworm
Still need to implement data migration from 03 to 04, but these changes should at least provision the Puppet services using the Debian provided packages.
1 parent 34c27ea commit e9fe279

File tree

8 files changed

+89
-47
lines changed

8 files changed

+89
-47
lines changed

manifests/site.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
role('puppet')
4343
}
4444

45+
# 2 CPU, 4 GB mem, Debian 12 Bookworm
46+
node 'puppet-04.ops.jquery.net' {
47+
role('puppet')
48+
}
49+
4550
# 2 CPU, 4 GB mem, Debian 11 Bullseye, 80 GB disk
4651
node 'swarm-02.ops.jquery.net' {
4752
role('testswarm')
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#!/bin/bash
22

33
set -euo pipefail
4-
sudo -u gitpuppet g10k -config /etc/puppetlabs/g10k.yaml
4+
5+
G10K_CONFIG_FILE=/etc/puppet/g10k.yaml
6+
if [ ! -f "$G10K_CONFIG_FILE" ]; then
7+
G10K_CONFIG_FILE=/etc/puppetlabs/g10k.yaml
8+
fi
9+
10+
sudo -u gitpuppet g10k -config "$G10K_CONFIG_FILE"

modules/profile/manifests/puppet/puppetdb.pp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,26 @@
1313
ensure => installed,
1414
}
1515

16-
$puppetservers = [$::facts['fqdn']]
16+
$puppetservers = jqlib::resource_hosts('class', 'profile::puppet::server')
1717

18-
file { '/etc/puppetlabs/puppetdb/cert-allowlist':
18+
$config_path = debian::codename() ? {
19+
'bullseye' => '/etc/puppetlabs/puppetdb',
20+
default => '/etc/puppetdb',
21+
}
22+
$var_path = debian::codename() ? {
23+
'bullseye' => '/opt/puppetlabs/server/data/puppetdb',
24+
default => '/var/lib/puppetdb',
25+
}
26+
27+
file { "${config_path}/cert-allowlist":
1928
ensure => file,
2029
mode => '0444',
2130
content => "${puppetservers.join("\n")}\n",
2231
notify => Service['puppetdb'],
2332
}
2433

2534
['config.ini', 'database.ini'].each |String $file| {
26-
file { "/etc/puppetlabs/puppetdb/conf.d/${file}":
35+
file { "${config_path}/conf.d/${file}":
2736
ensure => file,
2837
mode => '0440',
2938
group => 'puppetdb',

modules/profile/manifests/puppet/server.pp

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,44 @@
77
) {
88
include profile::puppet::common
99

10+
$termini_package = debian::codename() ? {
11+
'bullseye' => 'puppetdb-termini',
12+
default => 'puppet-terminus-puppetdb',
13+
}
14+
15+
$server_config_path = debian::codename() ? {
16+
'bullseye' => '/etc/puppetlabs/puppetserver',
17+
default => '/etc/puppet/puppetserver',
18+
}
19+
20+
$server_var_dir = debian::codename() ? {
21+
'bullseye' => '/opt/puppetlabs/server/data/puppetserver',
22+
default => '/var/lib/puppetserver',
23+
}
24+
25+
$server_run_dir = debian::codename() ? {
26+
'bullseye' => '/var/run/puppetlabs/puppetserver',
27+
default => '/run/puppetserver',
28+
}
29+
30+
$server_log_dir = debian::codename() ? {
31+
'bullseye' => '/var/log/puppetlabs/puppetserver',
32+
default => '/var/log/puppetserver',
33+
}
34+
35+
$code_path = debian::codename() ? {
36+
'bullseye' => '/etc/puppetlabs/code',
37+
default => '/etc/puppet/code',
38+
}
39+
40+
$g10k_config_path = debian::codename() ? {
41+
'bullseye' => '/etc/puppetlabs/g10k.yaml',
42+
default => '/etc/puppet/g10k.yaml',
43+
}
44+
1045
package { [
1146
'puppetserver',
12-
'puppetdb-termini',
47+
$termini_package,
1348
'g10k',
1449

1550
# for the htpasswd tool
@@ -23,11 +58,11 @@
2358
}
2459

2560
exec { 'remove-old-code-dir':
26-
command => '/usr/bin/mv /etc/puppetlabs/code /etc/puppetlabs/code-old',
27-
creates => '/etc/puppetlabs/code-old',
61+
command => "/usr/bin/mv ${code_path} ${code_path}-old",
62+
creates => "${code_path}-old",
2863
}
2964

30-
file { '/etc/puppetlabs/code':
65+
file { $code_path:
3166
ensure => directory,
3267
owner => 'gitpuppet',
3368
group => 'gitpuppet',
@@ -41,10 +76,10 @@
4176
ensure => directory,
4277
}
4378

44-
$g10k_deploy_base_path = '/etc/puppetlabs/code/environments'
79+
$g10k_deploy_base_path = "${code_path}/environments"
4580
$private_repo_dir = '/srv/git/puppet/private'
4681

47-
file { '/etc/puppetlabs/g10k.yaml':
82+
file { $g10k_config_path:
4883
ensure => file,
4984
content => template('profile/puppet/server/g10k.yaml.erb'),
5085
owner => 'root',
@@ -54,11 +89,11 @@
5489
}
5590

5691
exec { 'g10k':
57-
command => '/usr/bin/g10k -config /etc/puppetlabs/g10k.yaml',
92+
command => "/usr/bin/g10k -config ${g10k_config_path}",
5893
user => 'gitpuppet',
5994
refreshonly => true,
6095
logoutput => true,
61-
require => File['/etc/puppetlabs/code'],
96+
require => File[$code_path],
6297
}
6398

6499
file { '/usr/local/bin/puppet-merge':
@@ -94,7 +129,10 @@
94129
require => Exec['git-init-puppet-private'],
95130
}
96131

97-
file { '/etc/puppetlabs/hieradata':
132+
file { [
133+
'/etc/puppetlabs/hieradata',
134+
'/etc/puppet/hieradata'
135+
]:
98136
ensure => absent,
99137
recurse => true,
100138
force => true,
@@ -115,7 +153,7 @@
115153
Concat[$::profile::puppet::common::config_file] ~> Service['puppetserver']
116154

117155
['puppetserver.conf'].each |String $file| {
118-
file { "/etc/puppetlabs/puppetserver/conf.d/${file}":
156+
file { "${server_config_path}/conf.d/${file}":
119157
ensure => file,
120158
mode => '0440',
121159
group => 'puppet',
@@ -124,14 +162,14 @@
124162
}
125163
}
126164

127-
file { '/etc/puppetlabs/puppet/routes.yaml':
165+
file { "${profile::puppet::common::config_path}/routes.yaml":
128166
ensure => file,
129167
mode => '0444',
130168
content => template('profile/puppet/server/routes.yaml.erb'),
131169
notify => Service['puppetserver'],
132170
}
133171

134-
file { '/etc/puppetlabs/puppet/puppetdb.conf':
172+
file { "${profile::puppet::common::config_path}/puppetdb.conf":
135173
ensure => file,
136174
mode => '0444',
137175
content => template('profile/puppet/server/puppetdb.conf.erb'),
@@ -196,7 +234,6 @@
196234
mode => '0550',
197235
}
198236

199-
200237
include profile::ssh::ca
201238

202239
# Expose SSH keys so users can verify them

modules/profile/templates/puppet/puppetdb/config/config.ini.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
[global]
33
# Store mq/db data in a custom directory
4-
vardir = /opt/puppetlabs/server/data/puppetdb
4+
vardir = <%= @var_path %>
55

66
# Use an external logback config file
7-
logging-config = /etc/puppetlabs/puppetdb/logback.xml
7+
logging-config = <%= @config_path %>/logback.xml
88

99
[puppetdb]
10-
certificate-allowlist = /etc/puppetlabs/puppetdb/cert-allowlist
10+
certificate-allowlist = <%= @config_path %>/cert-allowlist
1111

1212
[command-processing]
1313
# How many command-processing threads to use, defaults to (CPUs / 2)
Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,24 @@
1-
###########################################
2-
# Init settings for puppetserver
3-
###########################################
4-
5-
# Location of your Java binary (version 8)
61
JAVA_BIN="/usr/bin/java"
72

83
# Modify this if you'd like to change the memory allocation, enable JMX, etc
94
JAVA_ARGS="-Xms<%= @java_memory %> -Xmx<%= @java_memory %> -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"
105

116
# Modify this as you would JAVA_ARGS but for non-service related subcommands
127
JAVA_ARGS_CLI="${JAVA_ARGS_CLI:-}"
13-
14-
# Modify this if you'd like TrapperKeeper specific arguments
158
TK_ARGS=""
169

17-
# These normally shouldn't need to be edited if using OS packages
1810
USER="puppet"
1911
GROUP="puppet"
12+
<%- if @server_config_path == '/etc/puppetlabs/puppetserver' -%>
2013
INSTALL_DIR="/opt/puppetlabs/server/apps/puppetserver"
2114
CONFIG="/etc/puppetlabs/puppetserver/conf.d"
22-
23-
# Bootstrap path
2415
BOOTSTRAP_CONFIG="/etc/puppetlabs/puppetserver/services.d/,/opt/puppetlabs/server/apps/puppetserver/config/services.d/"
16+
<%- else -%>
17+
INSTALL_DIR="/usr/share/puppetserver"
18+
CONFIG="/etc/puppet/puppetserver/conf.d"
19+
BOOTSTRAP_CONFIG="/etc/puppet/puppetserver/services.d"
20+
<%- end -%>
2521

26-
# SERVICE_STOP_RETRIES can be set here to alter the default stop timeout in
27-
# seconds. For systemd, the shorter of this setting or 'TimeoutStopSec' in
28-
# the systemd.service definition will effectively be the timeout which is used.
2922
SERVICE_STOP_RETRIES=60
30-
31-
# START_TIMEOUT can be set here to alter the default startup timeout in
32-
# seconds. For systemd, the shorter of this setting or 'TimeoutStartSec'
33-
# in the service's systemd.service configuration file will effectively be the
34-
# timeout which is used.
3523
START_TIMEOUT=300
36-
37-
38-
# Maximum number of seconds that can expire for a service reload attempt before
39-
# the result of the attempt is interpreted as a failure.
4024
RELOAD_TIMEOUT=120

modules/profile/templates/puppet/server/puppet.conf.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[server]
2-
vardir = /opt/puppetlabs/server/data/puppetserver
3-
logdir = /var/log/puppetlabs/puppetserver
4-
rundir = /var/run/puppetlabs/puppetserver
5-
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
6-
codedir = /etc/puppetlabs/code
2+
vardir = <%= @server_var_dir %>
3+
logdir = <%= @server_log_dir %>
4+
rundir = <%= @server_run_dir %>
5+
pidfile = <%= @server_run_dir %>/puppetserver.pid
6+
codedir = <%= @code_path %>
77
environment = <%= @environment %>
88

99
[master]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fake

0 commit comments

Comments
 (0)