3
0
This commit is contained in:
Arne Teuke
2025-10-27 15:47:43 +01:00
parent 06d3f02e9f
commit 137c0827cc
18 changed files with 5 additions and 543 deletions

View File

@@ -8,10 +8,6 @@ class puppet_cd::main::config (
) inherits puppet_cd::params {
include puppet_cd::server::service
if $pt_use_puppetdb == true {
include puppet_cd::puppetdb::service
}
if $pt_use_r10k == true {
include puppet_cd::r10k::install
}

View File

@@ -31,27 +31,4 @@ class puppet_cd::main::files (
notify => Service[$pt_agent_service,$pt_server_service],
}
}
if $pt_use_puppetdb == true {
file { $pt_puppetdb_conf_file:
ensure => file,
path => $pt_puppetdb_conf_file,
owner => 'root',
group => 'root',
mode => '0644',
content => template($pt_puppetdb_conf_erb),
# notify => Service[$pt_agent_service,$pt_server_service],
}
# fix service file syslog vs journald
file { $pt_puppetdb_service_file:
ensure => file,
path => $pt_puppetdb_service_file,
owner => 'root',
group => 'root',
mode => '0644',
content => template($pt_puppetdb_service_erb),
notify => Service[$pt_db_service],
}
}
}

View File

@@ -15,10 +15,5 @@ class puppet_cd::main::install (
ensure => $pt_pkg_ensure,
}
}
if $fqdn == $pt_db_fqdn {
package { $pt_db_pkg:
ensure => $pt_pkg_ensure,
}
}
}

View File

@@ -24,23 +24,4 @@ class puppet_cd::main::user (
allowdupe => false,
}
}
if ($fqdn == $pt_db_fqdn) and ($pt_manage_db_user == true) {
user { $pt_db_user:
ensure => present,
name => $pt_db_user,
allowdupe => false,
comment => $pt_db_user_comment,
gid => $pt_db_user,
managehome => true,
home => $pt_db_user_home,
shell => $pt_db_user_shell,
}
group { $pt_db_user:
ensure => present,
name => $pt_db_user,
allowdupe => false,
}
}
}

View File

@@ -90,7 +90,6 @@ class puppet_cd::params (
Boolean $pt_manage_fw = true,
String $pt_pm_fqdn = 'puppetmaster.example.net',
String $pt_db_fqdn = 'puppetdb.example.net',
# installation
String $pt_pkg_ensure = 'latest',
@@ -107,12 +106,7 @@ class puppet_cd::params (
String $pt_user_comment = 'puppetserver daemon',
String $pt_user_home = '/opt/puppetlabs/server/data/puppetserver',
String $pt_user_shell = '/sbin/nologin',
## puppetdb user
Boolean $pt_manage_db_user = false,
String $pt_db_user = 'puppetdb',
String $pt_db_user_comment = 'PuppetDB daemon',
String $pt_db_user_home = '/opt/puppetlabs/server/data/puppetdb',
String $pt_db_user_shell = '/sbin/nologin',
# templates
## puppet
String $pt_environment = 'production',
@@ -142,33 +136,6 @@ class puppet_cd::params (
String $pt_storeconfigs_backend = 'puppetdb',
String $pt_parser = 'current',
Boolean $pt_cert_revocation = true,
## puppetdb
Boolean $pt_use_puppetdb = false,
String $pt_logging_max_file_size = '200MB',
String $pt_logging_max_history = '90',
String $pt_logging_total_size = '1GB',
String $pt_com_proc_threads = '4',
String $pt_concurrent_writes = '4',
String $pt_db_subname = '//localhost:5432/puppetdb',
String $pt_db_username = 'foobar',
String $pt_db_password = 'foobar',
String $pt_gc_interval = '60',
String $pt_log_slow_statements = '10',
String $pt_no_ssl_port = '8080',
String $pt_ssl_port = '8081',
Boolean $pt_use_ssl_only = true,
String $pt_puppetdb_source_lan = '0.0.0.0/0',
Boolean $pt_soft_write_failure = false,
String $pt_no_ssl_host = '0.0.0.0',
String $pt_ssl_host = '0.0.0.0',
String $pt_ssl_key = '/etc/puppetlabs/puppetdb/ssl/private.pem',
String $pt_ssl_cert = '/etc/puppetlabs/puppetdb/ssl/public.pem',
String $pt_ssl_ca_cert = '/etc/puppetlabs/puppetdb/ssl/ca.pem',
Boolean $pt_log_access = false,
String $pt_access_log_config = '/etc/puppetlabs/puppetdb/request-logging.xml',
Boolean $pt_enable_repl = false,
String $pt_repl_port = '8082',
String $pt_repl_host = '127.0.0.1',
# r10k
Boolean $pt_use_r10k = false,
@@ -197,12 +164,7 @@ class puppet_cd::params (
$pt_rundir_master = '/var/run/puppetlabs/puppetserver'
$pt_vardir = '/opt/puppetlabs/puppet/cache'
$pt_vardir_master = '/opt/puppetlabs/server/data/puppetserver'
## puppetdb
$pt_puppetdb_main = '/etc/puppetlabs/puppetdb'
$pt_puppetdb_conf_d = "${pt_puppetdb_main}/conf.d"
$pt_puppetdb_ssl = "${pt_puppetdb_main}/ssl"
$pt_puppetdb_log = '/var/log/puppetlabs/puppetdb'
$pt_puppetdb_var_dir = '/opt/puppetlabs/server/data/puppetdb'
## r10k
$pt_r10k_dir = "${pt_main_dir}/r10k"
$pt_r10k_webhook_dir = '/etc/r10k-webhook'
@@ -213,26 +175,7 @@ class puppet_cd::params (
$pt_puppet_conf_erb = 'puppet_cd/puppet.conf.erb'
$pt_agent_conf_erb = 'puppet_cd/agent.conf.erb'
$pt_hiera_config = "${pt_puppetdir}/hiera.yaml"
## puppetdb
$pt_bootstrap_conf = "${pt_puppetdb_main}/bootstrap.cfg"
$pt_bootstrap_erb = 'puppet_cd/puppetdb/bootstrap.cfg.erb'
$pt_puppetdb_access_log = "${pt_puppetdb_log}/puppetdb-access"
$pt_request_logging_conf = "${pt_puppetdb_main}/request-logging.xml"
$pt_request_logging_erb = 'puppet_cd/puppetdb/request_logging.xml.erb'
$pt_logback_conf = "${pt_puppetdb_main}/logback.xml"
$pt_logback_erb = 'puppet_cd/puppetdb/logback.xml.erb'
$pt_puppetdb_config_ini = "${pt_puppetdb_conf_d}/config.ini"
$pt_puppetdb_config_erb = 'puppet_cd/puppetdb/config.ini.erb'
$pt_puppetdb_database_ini = "${pt_puppetdb_conf_d}/database.ini"
$pt_puppetdb_database_erb = 'puppet_cd/puppetdb/database.ini.erb'
$pt_puppetdb_jetty_ini = "${pt_puppetdb_conf_d}/jetty.ini"
$pt_puppetdb_jetty_erb = 'puppet_cd/puppetdb/jetty.ini.erb'
$pt_puppetdb_conf_file = "${pt_puppetdir}/puppetdb.conf"
$pt_puppetdb_conf_erb = 'puppet_cd/puppetdb/puppetdb.conf.erb'
$pt_puppetdb_repl_ini = "${pt_puppetdb_conf_d}/repl.ini"
$pt_puppetdb_repl_erb = 'puppet_cd/puppetdb/repl.ini.erb'
$pt_puppetdb_service_file = '/usr/lib/systemd/system/puppetdb.service'
$pt_puppetdb_service_erb = 'puppet_cd/puppetdb/puppetdb_service.erb'
## r10k
$pt_r10k_file = "${pt_r10k_dir}/r10k.yaml"
$pt_r10k_erb = 'puppet_cd/r10k/r10k.yaml.erb'
@@ -243,7 +186,6 @@ class puppet_cd::params (
# service
$pt_server_service = 'puppetserver'
$pt_agent_service = 'puppet'
$pt_db_service = 'puppetdb'
$pt_r10k_webhook_service = 'r10k_gitlab_webhook'
#

View File

@@ -1,64 +0,0 @@
## puppet_cd::puppetdb::dirs.pp
# Module name: puppet_cd
# Author: Arne Teuke (arne_teuke@confdroid)
# @summary Class manages puppetdb directories
###############################################################################
class puppet_cd::puppetdb::dirs (
) inherits puppet_cd::params {
if ($fqdn == $pt_db_fqdn) and ($pt_use_puppetdb == true) {
require puppet_cd::main::install
# main directory
file { $pt_puppetdb_main:
ensure => directory,
path => $pt_puppetdb_main,
owner => $pt_db_user,
group => $pt_db_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
}
# conf.d directory
file { $pt_puppetdb_conf_d:
ensure => directory,
path => $pt_puppetdb_conf_d,
owner => $pt_db_user,
group => $pt_db_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
}
# ssl directory
file { $pt_puppetdb_ssl:
ensure => directory,
path => $pt_puppetdb_ssl,
owner => $pt_db_user,
group => $pt_db_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
}
# log dir
file { $pt_puppetdb_log:
ensure => directory,
path => $pt_puppetdb_log,
owner => $pt_db_user,
group => $pt_db_user,
mode => '0700',
selrange => s0,
selrole => object_r,
seltype => var_log_t,
seluser => system_u,
}
}
}

View File

@@ -1,117 +0,0 @@
## puppet_cd::puppetdb::files.pp
# Module name: puppet_cd
# Author: Arne Teuke (arne_teuke@confdroid)
# @summary Class manages puppetdb files
###############################################################################
class puppet_cd::puppetdb::files (
) inherits puppet_cd::params {
if ($fqdn == $pt_db_fqdn) and ($pt_use_puppetdb == true) {
require puppet_cd::puppetdb::dirs
# bootstrap.cfg
file { $pt_bootstrap_conf:
ensure => file,
path => $pt_bootstrap_conf,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_bootstrap_erb),
notify => Service[$pt_db_service],
}
# requestlogging.xml
file { $pt_request_logging_conf:
ensure => file,
path => $pt_request_logging_conf,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_request_logging_erb),
notify => Service[$pt_db_service],
}
# logback.xml
file { $pt_logback_conf:
ensure => file,
path => $pt_logback_conf,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_logback_erb),
notify => Service[$pt_db_service],
}
# config.ini
file { $pt_puppetdb_config_ini:
ensure => file,
path => $pt_puppetdb_config_ini,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_puppetdb_config_erb),
notify => Service[$pt_db_service],
}
# database.ini
file { $pt_puppetdb_database_ini:
ensure => file,
path => $pt_puppetdb_database_ini,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_puppetdb_database_erb),
notify => Service[$pt_db_service],
}
# jetty.ini
file { $pt_puppetdb_jetty_ini :
ensure => file,
path => $pt_puppetdb_jetty_ini ,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_puppetdb_jetty_erb),
notify => Service[$pt_db_service],
}
# repl.ini
file { $pt_puppetdb_repl_ini:
ensure => file,
path => $pt_puppetdb_repl_ini,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_puppetdb_repl_erb),
notify => Service[$pt_db_service],
}
}
}

View File

@@ -1,19 +0,0 @@
## puppet_cd::puppetdb::service.pp
# Module name: puppet_cd
# Author: Arne Teuke (arne_teuke@confdroid)
# @summary Class manages puppetdb service
###############################################################################
class puppet_cd::puppetdb::service (
) inherits puppet_cd::params {
if ($fqdn == $pt_db_fqdn) and ($pt_use_puppetdb == true) {
require puppet_cd::puppetdb::files
service { $pt_db_service:
ensure => running,
hasstatus => true,
hasrestart => true,
enable => true,
}
}
}