Skip to content

Commit 98d39f2

Browse files
authored
Merge pull request #137 from vutny/skip-acls
Skip configuring ACLs in `pg_hba.conf` if not provided
2 parents 7aacf98 + 69a59b6 commit 98d39f2

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

pillar.example

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ postgres:
4141
#
4242
# The uppercase items must be replaced by actual values.
4343
# METHOD could be omitted, 'md5' will be appended by default.
44+
#
45+
# If ``acls`` item value is empty ('', [], null), then the contents of
46+
# ``pg_hba.conf`` file will not be touched at all.
4447
acls:
4548
- ['local', 'db1', 'localUser']
4649
- ['host', 'db2', 'remoteUser', '192.168.33.0/24']
@@ -52,7 +55,7 @@ postgres:
5255

5356
# If Salt is unable to detect init system running in the scope of state run,
5457
# probably we are trying to bake a container/VM image with PostgreSQL.
55-
# Use ``bake_image`` setting to contol how PostgreSQL will be started: if set
58+
# Use ``bake_image`` setting to control how PostgreSQL will be started: if set
5659
# to ``True`` the raw ``pg_ctl`` will be utilized instead of packaged init
5760
# script, job or unit run with Salt ``service`` state.
5861
bake_image: True
@@ -62,7 +65,7 @@ postgres:
6265
# Create/remove users, tablespaces, databases, schema and extensions.
6366
# Each of these dictionaries contains PostgreSQL entities which
6467
# mapped to the ``postgres_*`` Salt states with arguments. See the Salt
65-
# documentaion to get all supported argument for a particular state.
68+
# documentation to get all supported argument for a particular state.
6669
#
6770
# Format is the following:
6871
#

postgres/server/init.sls

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,17 @@ postgresql-conf:
9393
postgresql-pg_hba:
9494
file.managed:
9595
- name: {{ postgres.conf_dir }}/pg_hba.conf
96-
- source: {{ postgres['pg_hba.conf'] }}
97-
- template: jinja
9896
- user: {{ postgres.user }}
9997
- group: {{ postgres.group }}
10098
- mode: 600
99+
{%- if postgres.acls %}
100+
- source: {{ postgres['pg_hba.conf'] }}
101+
- template: jinja
101102
- defaults:
102103
acls: {{ postgres.acls }}
104+
{%- else %}
105+
- replace: False
106+
{%- endif %}
103107
- require:
104108
- file: postgresql-config-dir
105109

0 commit comments

Comments
 (0)