Files

57 lines
1.7 KiB
ObjectPascal
Raw Permalink Normal View History

2025-12-05 13:06:10 +01:00
## confdroid_postgresql::bouncer::bouncer.pp
# Module name: confdroid_postgresql
2025-12-05 14:22:43 +01:00
# Author: 12ww1160 (12ww1160@confdroid.com)
2025-12-05 13:06:10 +01:00
# @summary Class manages the pgbouncer service
2025-12-05 15:09:55 +01:00
# @example confdroid_postgresql::bouncer::bouncer_rule { 'test connection':
# pl_bouncer_db_name => 'test',
# pl_bouncer_host => '127.0.0.7',
# pl_bouncer_host_port => '5432',
# pl_bouncer_user => 'test_user',
# pl_bouncer_order => '001',
2025-12-05 15:09:55 +01:00
# }
2025-12-05 13:06:10 +01:00
###############################################################################
class confdroid_postgresql::bouncer::bouncer (
) inherits confdroid_postgresql::params {
if ($fqdn == $pl_server_fqdn) and ($pl_use_pg_bouncer == true) {
2025-12-05 14:02:54 +01:00
# 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),
}
2025-12-05 13:06:10 +01:00
2025-12-05 14:02:54 +01:00
# create the pgbouncer.ini file
2025-12-05 13:06:10 +01:00
concat { $pl_bouncer_ini_file:
ensure => present,
2025-12-05 14:02:54 +01:00
owner => 'pgbouncer',
2025-12-05 13:06:10 +01:00
mode => '0600',
2025-12-05 14:02:54 +01:00
#notify => Service[$pl_service],
2025-12-05 13:06:10 +01:00
}
# manage file header
2025-12-05 14:28:25 +01:00
concat::fragment { 'bouncer_header':
2025-12-05 13:06:10 +01:00
target => $pl_bouncer_ini_file,
content => template($pl_bouncer_ini_erb),
order => '000',
}
}
}