Skip to content

Commit eb729ff

Browse files
committed
Use v10+ acls only when applicable
1 parent 9fdce93 commit eb729ff

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

postgres/defaults.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ postgres:
4747
- ['host', 'all', 'all', '127.0.0.1/32', 'md5']
4848
# IPv6 local connections:
4949
- ['host', 'all', 'all', '::1/128', 'md5']
50+
acls_v10:
5051
# Allow replication connections from localhost, by a user with the
5152
# replication privilege.
5253
- ['local', 'replication', 'all', 'peer']

postgres/server/init.sls

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ postgresql-conf:
107107
{%- endif %}
108108
109109
{%- set pg_hba_path = salt['file.join'](postgres.conf_dir, 'pg_hba.conf') %}
110+
{%- set acls = postgres.acls %}
111+
{%- if postgres.version|to_num >= 10 %}
112+
{%- set acls = acls + postgres.acls_v10 %}
113+
{%- endif %}
110114
111115
postgresql-pg_hba:
112116
file.managed:
@@ -118,7 +122,7 @@ postgresql-pg_hba:
118122
- source: {{ postgres['pg_hba.conf'] }}
119123
- template: jinja
120124
- defaults:
121-
acls: {{ postgres.acls|yaml() }}
125+
acls: {{ acls|yaml() }}
122126
{%- if postgres.config_backup %}
123127
# Create the empty file before managing to overcome the limitation of check_cmd
124128
- onlyif: test -f {{ pg_hba_path }} || touch {{ pg_hba_path }}

0 commit comments

Comments
 (0)