diff options
-rw-r--r-- | modules/role/manifests/backup/postgresql.pp | 14 | ||||
-rw-r--r-- | modules/role/templates/backup/postgresql.conf.erb | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/modules/role/manifests/backup/postgresql.pp b/modules/role/manifests/backup/postgresql.pp index 9e1c9f7..aef177b 100644 --- a/modules/role/manifests/backup/postgresql.pp +++ b/modules/role/manifests/backup/postgresql.pp | |||
@@ -121,6 +121,12 @@ class role::backup::postgresql inherits role::backup { | |||
121 | } else { | 121 | } else { |
122 | $pg_backup_host = $host["vars"]["real_hostname"][0] | 122 | $pg_backup_host = $host["vars"]["real_hostname"][0] |
123 | } | 123 | } |
124 | if has_key($host["vars"], "postgresql_backup_port") { | ||
125 | $pg_listen_port = $host["vars"]["postgresql_backup_port"][0] | ||
126 | } else { | ||
127 | $pg_listen_port = undef | ||
128 | } | ||
129 | |||
124 | $pg_path = "$mountpoint/$pg_backup_host/postgresql" | 130 | $pg_path = "$mountpoint/$pg_backup_host/postgresql" |
125 | $pg_backup_path = "$mountpoint/$pg_backup_host/postgresql_backup" | 131 | $pg_backup_path = "$mountpoint/$pg_backup_host/postgresql_backup" |
126 | $pg_host = "$pg_backup_host" | 132 | $pg_host = "$pg_backup_host" |
@@ -152,10 +158,16 @@ class role::backup::postgresql inherits role::backup { | |||
152 | } | 158 | } |
153 | 159 | ||
154 | if !empty($ldap_filter) and ($pg_infos["pgbouncer"]) { | 160 | if !empty($ldap_filter) and ($pg_infos["pgbouncer"]) { |
161 | if empty($pg_listen_port) { | ||
162 | $pg_listen_port_key = "" | ||
163 | } else { | ||
164 | $pg_listen_port_key = "port=$pg_listen_port" | ||
165 | } | ||
166 | |||
155 | concat::fragment { "pgbouncer_$pg_backup_host": | 167 | concat::fragment { "pgbouncer_$pg_backup_host": |
156 | target => "/etc/pgbouncer/pgbouncer.ini", | 168 | target => "/etc/pgbouncer/pgbouncer.ini", |
157 | order => 02, | 169 | order => 02, |
158 | content => "${pg_infos[pgbouncer_dbname]} = host=$mountpoint/$pg_backup_host/postgresql user=${pg_infos[dbuser]} dbname=${pg_infos[dbname]}", | 170 | content => "${pg_infos[pgbouncer_dbname]} = host=$mountpoint/$pg_backup_host/postgresql $pg_listen_port_key user=${pg_infos[dbuser]} dbname=${pg_infos[dbname]}", |
159 | } | 171 | } |
160 | 172 | ||
161 | postgresql::server::pg_hba_rule { "$pg_backup_host - local access as ${pg_infos[dbuser]} user": | 173 | postgresql::server::pg_hba_rule { "$pg_backup_host - local access as ${pg_infos[dbuser]} user": |
diff --git a/modules/role/templates/backup/postgresql.conf.erb b/modules/role/templates/backup/postgresql.conf.erb index 860089b..c4d223e 100644 --- a/modules/role/templates/backup/postgresql.conf.erb +++ b/modules/role/templates/backup/postgresql.conf.erb | |||
@@ -1,5 +1,10 @@ | |||
1 | <%- if !@pg_listen_port.nil? -%> | ||
2 | listen_addresses= '*' | ||
3 | port = <%= @pg_listen_port %> | ||
4 | ssl = on | ||
5 | <%- else -%> | ||
1 | listen_addresses= '' | 6 | listen_addresses= '' |
7 | <%- end %> | ||
2 | unix_socket_directories = '<%= @pg_path %>' | 8 | unix_socket_directories = '<%= @pg_path %>' |
3 | data_directory = '<%= @pg_path %>' | 9 | data_directory = '<%= @pg_path %>' |
4 | wal_level = logical | 10 | wal_level = logical |
5 | |||