3
0

add bouncer details

This commit is contained in:
12ww1160
2025-12-05 14:02:54 +01:00
parent c4fcffcb40
commit 527c6d784b
6 changed files with 448 additions and 11 deletions

View File

@@ -7,13 +7,36 @@ class confdroid_postgresql::bouncer::bouncer (
) inherits confdroid_postgresql::params {
if ($fqdn == $pl_server_fqdn) and ($pl_use_pg_bouncer == true) {
# create the pgbouncer.ini file
# ensure directory exists
file { $pl_bouncer_dir:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
}
# create auth user file to be populated through placeholder
file { $pl_bouncer_auth_file:
ensure => file,
owner => 'pgbouncer',
group => 'pgbouncer',
mode => '0440',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template($pl_bouncer_auth_erb),
}
# create the pgbouncer.ini file
concat { $pl_bouncer_ini_file:
ensure => present,
owner => 'postgres',
owner => 'pgbouncer',
mode => '0600',
notify => Service[$pl_service],
#notify => Service[$pl_service],
}
# manage file header

View File

@@ -6,15 +6,15 @@
class confdroid_postgresql::main::config (
) inherits confdroid_postgresql::params {
include confdroid_postgresql::main::install
require confdroid_postgresql::main::install
if $fqdn == $pl_server_fqdn {
include confdroid_postgresql::server::service
# if $pl_use_exporter == true {
# include confdroid_postgresql::exporter::service
# }
# if $pl_use_pg_bouncer == true {
# include confdroid_postgresql::bouncer::service
# }
if $pl_use_pg_bouncer == true {
include confdroid_postgresql::bouncer::service
}
}
}

View File

@@ -29,8 +29,8 @@
# @param [Boolean] pl_use_pg_bouncer whether to use the pc_bouncer
# @param [String] pl_bouncer_listen_addr bouncer listen address
# @param [String] pl_bouncer_port bouncer listen port
# @param [String] pl_bouncer_auth_file bouncer auth file
# @param [String] pl_bouncer_auth_mode bouncer auth mode
# @param [String] pl_bouncer_auth_users placeholder for users
# @param [String] pl_bouncer_pool_mode bouncer pool mode
# @param [String] pl_bouncer_mx_cl_conn bouncer max client connections
# @param [String] pl_bouncer_pool_size bouncer default pool size
@@ -72,8 +72,8 @@ class confdroid_postgresql::params (
Boolean $pl_use_pg_bouncer = false,
String $pl_bouncer_listen_addr = '0.0.0.0',
String $pl_bouncer_port = '6432',
String $pl_bouncer_auth_file = '/etc/pgbouncer/userlist.txt',
String $pl_bouncer_auth_mode = 'md5',
String $pl_bouncer_auth_users = 'placeholder',
String $pl_bouncer_pool_mode = 'transaction',
String $pl_bouncer_mx_cl_conn = '100',
String $pl_bouncer_pool_size = '20',
@@ -86,13 +86,16 @@ class confdroid_postgresql::params (
# Directories
$pl_data_dir = '/var/lib/pgsql/data/'
$pl_bouncer_dir = '/etc/pgbouncer'
# files
$pl_pg_hba_conf = "${pl_data_dir}/pg_hba.conf"
$pl_pg_hba_rule_conf = 'confdroid_postgresql/server/pghba/pg_hba_rule.conf.erb'
$pl_pg_hba_conf_erb = 'confdroid_postgresql/server/pghba/pg_hba.conf.erb'
$pl_bouncer_ini_file = '/etc/pgbouncer/pgbouncer.ini',
$pl_bouncer_ini_file = "${pl_bouncer_dir}/pgbouncer.ini",
$pl_bouncer_ini_erb = 'confdroid_postgresql/server/bouncer/pgbouncer.ini.erb'
$pl_bouncer_auth_file = "${pl_bouncer_dir}/userlist.txt",
$pl_bouncer_auth_erb = 'confdroid_postgresql/server/bouncer/bouncer_users.erb'
# Service
$pl_service = 'postgresql'