diff options
Diffstat (limited to 'modules/profile/manifests/postgresql/replication.pp')
-rw-r--r-- | modules/profile/manifests/postgresql/replication.pp | 36 |
1 files changed, 24 insertions, 12 deletions
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 @@ | |||
1 | define profile::postgresql::replication ( | 1 | define profile::postgresql::replication ( |
2 | Boolean $handle_role = false, | 2 | Boolean $handle_role = false, |
3 | Boolean $add_self_role = false, | 3 | Boolean $handle_config = false, |
4 | Boolean $handle_slot = false, | 4 | Boolean $add_self_role = false, |
5 | Boolean $handle_slot = false, | ||
6 | Optional[String] $target = undef, | ||
5 | ) { | 7 | ) { |
6 | include "profile::postgresql::pam_ldap" | 8 | include "profile::postgresql::pam_ldap" |
7 | 9 | ||
@@ -12,9 +14,11 @@ define profile::postgresql::replication ( | |||
12 | fail("Unable to find host for replication") | 14 | fail("Unable to find host for replication") |
13 | } | 15 | } |
14 | 16 | ||
15 | ensure_resource("postgresql::server::config_entry", "wal_level", { | 17 | if empty($target) { |
16 | value => "logical", | 18 | $pg_version = undef |
17 | }) | 19 | } else { |
20 | $pg_version = "10" | ||
21 | } | ||
18 | 22 | ||
19 | $host_infos["ipHostNumber"].each |$ip| { | 23 | $host_infos["ipHostNumber"].each |$ip| { |
20 | $infos = split($ip, "/") | 24 | $infos = split($ip, "/") |
@@ -28,15 +32,23 @@ define profile::postgresql::replication ( | |||
28 | } | 32 | } |
29 | 33 | ||
30 | postgresql::server::pg_hba_rule { "allow TCP access for replication to user $host_cn from $ipaddress/$mask": | 34 | postgresql::server::pg_hba_rule { "allow TCP access for replication to user $host_cn from $ipaddress/$mask": |
31 | type => 'hostssl', | 35 | type => 'hostssl', |
32 | database => 'replication', | 36 | database => 'replication', |
33 | user => $host_cn, | 37 | user => $host_cn, |
34 | address => "$ipaddress/$mask", | 38 | address => "$ipaddress/$mask", |
35 | auth_method => 'pam', | 39 | auth_method => 'pam', |
36 | order => "06-01", | 40 | order => "06-01", |
41 | target => $target, | ||
42 | postgresql_version => $pg_version, | ||
37 | } | 43 | } |
38 | } | 44 | } |
39 | 45 | ||
46 | if $handle_config { | ||
47 | ensure_resource("postgresql::server::config_entry", "wal_level", { | ||
48 | value => "logical", | ||
49 | }) | ||
50 | } | ||
51 | |||
40 | if $handle_role { | 52 | if $handle_role { |
41 | postgresql::server::role { $host_cn: | 53 | postgresql::server::role { $host_cn: |
42 | replication => true, | 54 | replication => true, |