X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprofile%2Fmanifests%2Fpostgresql%2Freplication.pp;h=2fcb71cda258727834f6699c4aa576d291dc8e64;hb=d2f031ece106ed2dc37283b194edfa94718a6306;hp=33b147fb74f2b7c22dedc5eab0193d229cf79c36;hpb=c53ac3f84852a42aa8b7341ee7fe0a629d2e3579;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/profile/manifests/postgresql/replication.pp b/modules/profile/manifests/postgresql/replication.pp index 33b147f..2fcb71c 100644 --- a/modules/profile/manifests/postgresql/replication.pp +++ b/modules/profile/manifests/postgresql/replication.pp @@ -1,7 +1,9 @@ define profile::postgresql::replication ( - Boolean $handle_role = false, - Boolean $add_self_role = false, - Boolean $handle_slot = false, + Boolean $handle_role = false, + Boolean $handle_config = false, + Boolean $add_self_role = false, + Boolean $handle_slot = false, + Optional[String] $target = undef, ) { include "profile::postgresql::pam_ldap" @@ -12,9 +14,11 @@ define profile::postgresql::replication ( fail("Unable to find host for replication") } - ensure_resource("postgresql::server::config_entry", "wal_level", { - value => "logical", - }) + if empty($target) { + $pg_version = undef + } else { + $pg_version = "10" + } $host_infos["ipHostNumber"].each |$ip| { $infos = split($ip, "/") @@ -28,15 +32,23 @@ define profile::postgresql::replication ( } postgresql::server::pg_hba_rule { "allow TCP access for replication to user $host_cn from $ipaddress/$mask": - type => 'hostssl', - database => 'replication', - user => $host_cn, - address => "$ipaddress/$mask", - auth_method => 'pam', - order => "06-01", + type => 'hostssl', + database => 'replication', + user => $host_cn, + address => "$ipaddress/$mask", + auth_method => 'pam', + order => "06-01", + target => $target, + postgresql_version => $pg_version, } } + if $handle_config { + ensure_resource("postgresql::server::config_entry", "wal_level", { + value => "logical", + }) + } + if $handle_role { postgresql::server::role { $host_cn: replication => true,