add bouncer
This commit is contained in:
26
manifests/bouncer/bouncer.pp
Normal file
26
manifests/bouncer/bouncer.pp
Normal file
@@ -0,0 +1,26 @@
|
||||
## confdroid_postgresql::bouncer::bouncer.pp
|
||||
# Module name: confdroid_postgresql
|
||||
# Author: Arne Teuke (12ww1160@confdroid.com)
|
||||
# @summary Class manages the pgbouncer service
|
||||
###############################################################################
|
||||
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
|
||||
|
||||
concat { $pl_bouncer_ini_file:
|
||||
ensure => present,
|
||||
owner => 'postgres',
|
||||
mode => '0600',
|
||||
notify => Service[$pl_service],
|
||||
}
|
||||
|
||||
# manage file header
|
||||
concat::fragment { 'header':
|
||||
target => $pl_bouncer_ini_file,
|
||||
content => template($pl_bouncer_ini_erb),
|
||||
order => '000',
|
||||
}
|
||||
}
|
||||
}
|
||||
26
manifests/bouncer/bouncer_rule.pp
Normal file
26
manifests/bouncer/bouncer_rule.pp
Normal file
@@ -0,0 +1,26 @@
|
||||
# confdroid_postgresql::bouncer::rule.pp
|
||||
# Module name: confdroid_postgresql
|
||||
# Author: Arne Teuke (12ww1160@confdroid.com)
|
||||
# @summary define manages rule entries for bouncer rules
|
||||
# @see https://www.postgresql.org/docs/9.6/static/auth-pg-hba-conf.html
|
||||
# @param [String] pl_bouncer_db_name db name for the bouncer rule
|
||||
# @param [String] pl_bouncer_host IP of the db host to bounce to
|
||||
# @param [String] pl_bouncer_port port of the db host to bounce to
|
||||
##############################################################################
|
||||
define confdroid_postgresql::bouncer::rule (
|
||||
|
||||
String $pl_bouncer_db_name = undef,
|
||||
String $pl_bouncer_host = '127.0.0.1',
|
||||
String $pl_bouncer_port = '5432',
|
||||
String $pl_bounce_order = undef,
|
||||
|
||||
) {
|
||||
$pl_bouncer_ini_file = $confdroid_postgresql::params::pl_bouncer_ini_file
|
||||
$pl_bouncer_ini_erb = $confdroid_postgresql::params::pl_bouncer_ini_erb
|
||||
|
||||
concat::fragment { "pl_bouncer_rule_${name}":
|
||||
target => $pl_bouncer_ini_file,
|
||||
content => template($pl_bouncer_ini_erb),
|
||||
order => $pl_bounce_order,
|
||||
}
|
||||
}
|
||||
18
manifests/bouncer/service.pp
Normal file
18
manifests/bouncer/service.pp
Normal file
@@ -0,0 +1,18 @@
|
||||
## confdroid_postgresql::bouncer::service.pp
|
||||
# Module name: confdroid_postgresql
|
||||
# Author: Arne Teuke (12ww1160@confdroid.com)
|
||||
# @summary Class manages the pgbouncer service
|
||||
###############################################################################
|
||||
class confdroid_postgresql::bouncer::service (
|
||||
|
||||
) inherits confdroid_postgresql::params {
|
||||
if ($fqdn == $pl_server_fqdn) and ($pl_use_pg_bouncer == true) {
|
||||
require confdroid_postgresql::bouncer::bouncer
|
||||
service { $pl_bouncer_service:
|
||||
ensure => running,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
enable => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user