3
0

update erb

This commit is contained in:
Arne Teuke
2025-02-26 21:13:33 +01:00
parent f3eaf43384
commit 9f78fd71fe
3 changed files with 103 additions and 5 deletions

View File

@@ -7,4 +7,40 @@ class puppet_cd::main::files (
) inherits puppet_cd::params {
require puppet_cd::main::dirs
if $fqdn != $pt_pm_fqdn {
file { $pt_puppet_conf_file:
ensure => file,
path => $pt_puppet_conf_file,
owner => 'root',
group => 'root',
mode => '0644',
content => template($pt_puppet_conf_erb),
notify => Service[$pt_agent_service],
}
}
if $fqdn == $pt_pm_fqdn {
file { $pt_puppet_conf_file:
ensure => file,
path => $pt_puppet_conf_file,
owner => 'root',
group => 'root',
mode => '0644',
content => template($pt_puppet_conf_erb),
notify => Service[$pt_agent_service,$pt_server_service],
}
}
if $pt_use_puppetdb == true {
file { $pt_puppetdb_conf_file:
ensure => filet,
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],
}
}
}

View File

@@ -41,11 +41,7 @@ class puppet_cd::params (
String $pt_agent_pkg = 'puppet-agent',
String $pt_server_pkg = 'puppetserver',
Array $pt_db_pkg = ['puppetdb','puppetdb-termini'],
# puppetdb
Boolean $pt_use_puppetdb = false,
String $pt_no_ssl_port = '8080',
String $pt_ssl_port = '8081',
Boolean $pt_use_ssl_only = true,
# user settings
## puppet user
Boolean $pt_manage_user = true,
@@ -60,6 +56,7 @@ class puppet_cd::params (
String $pt_db_user_home = '/opt/puppetlabs/server/data/puppetdb',
String $pt_db_user_shell = '/sbin/nologin',
# templates
## puppet
String $pt_environment = 'production',
Boolean $pt_allow_duplicate_certs = false,
String $pt_basemodulepath = '/etc/puppetlabs/code/environments/common:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules:/usr/share/puppet/modules',
@@ -87,11 +84,39 @@ class puppet_cd::params (
Boolean $pt_storeconfigs = true,
String $pt_storeconfigs_backend = 'puppetdb',
String $pt_parser = 'current',
## 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_ssh_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',
) {
$fqdn = $facts['networking']['fqdn']
# directories
## puppet
$pt_main_dir = '/etc/puppetlabs'
$pt_puppetdir = "${pt_main_dir}/puppet"
$pt_code_dir = "${pt_main_dir}/code"
@@ -102,6 +127,36 @@ 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'
# files
## puppet
$pt_puppet_conf_file = "${pt_puppetdir}/puppet.conf"
$pt_puppet_conf_erb = 'puppet_cd/puppet.conf.erb'
$pt_hiera_config = "${pt_puppetdir}/hiera.yaml"
## puppetdb
$pt_bootstrap_conf = "${pt_puppetdb_main}/bootstrap.cfg"
$pt_bootstrap_erb = 'cd_puppet/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 = 'cd_puppet/puppetdb/request_logging.xml.erb'
$pt_logback_conf = "${pt_puppetdb_main}/logback.xml"
$pt_logback_erb = 'cd_puppet/puppetdb/logback.xml.erb'
$pt_puppetdb_config_ini = "${pt_puppetdb_conf_d}/config.ini"
$pt_puppetdb_config_erb = 'cd_puppet/puppetdb/config.ini.erb'
$pt_puppetdb_database_ini = "${pt_puppetdb_conf_d}/database.ini"
$pt_puppetdb_database_erb = 'cd_puppet/puppetdb/database.ini.erb'
$pt_puppetdb_jetty_ini = "${pt_puppetdb_conf_d}/jetty.ini"
$pt_puppetdb_jetty_erb = 'cd_puppet/puppetdb/jetty.ini.erb'
$pt_puppetdb_conf_file = "${pt_puppetdir}/puppetdb.conf"
$pt_puppetdb_conf_erb = 'cd_puppet/puppetdb/puppetdb.conf.erb'
$pt_puppetdb_repl_ini = "${pt_puppetdb_conf_d}/repl.ini"
$pt_puppetdb_repl_erb = 'cd_puppet/puppetdb/repl.ini.erb'
# service
$pt_server_service = 'puppetserver'

View File

@@ -0,0 +1,7 @@
###############################################################################
########## puppetdb.conf managed by puppet agent ##########
###############################################################################
[main]
server_urls = https://<%= @pt_db_fqdn %>:<%= @pt_ssl_port %>
soft_write_failure = <%= @pt_soft_write_failure %>