mirror of
https://github.com/saltstack-formulas/postgres-formula.git
synced 2025-04-16 09:40:26 +00:00
Merge pull request #137 from vutny/skip-acls
Skip configuring ACLs in `pg_hba.conf` if not provided
This commit is contained in:
commit
98d39f296e
2 changed files with 11 additions and 4 deletions
|
@ -41,6 +41,9 @@ postgres:
|
||||||
#
|
#
|
||||||
# The uppercase items must be replaced by actual values.
|
# The uppercase items must be replaced by actual values.
|
||||||
# METHOD could be omitted, 'md5' will be appended by default.
|
# METHOD could be omitted, 'md5' will be appended by default.
|
||||||
|
#
|
||||||
|
# If ``acls`` item value is empty ('', [], null), then the contents of
|
||||||
|
# ``pg_hba.conf`` file will not be touched at all.
|
||||||
acls:
|
acls:
|
||||||
- ['local', 'db1', 'localUser']
|
- ['local', 'db1', 'localUser']
|
||||||
- ['host', 'db2', 'remoteUser', '192.168.33.0/24']
|
- ['host', 'db2', 'remoteUser', '192.168.33.0/24']
|
||||||
|
@ -52,7 +55,7 @@ postgres:
|
||||||
|
|
||||||
# If Salt is unable to detect init system running in the scope of state run,
|
# If Salt is unable to detect init system running in the scope of state run,
|
||||||
# probably we are trying to bake a container/VM image with PostgreSQL.
|
# probably we are trying to bake a container/VM image with PostgreSQL.
|
||||||
# Use ``bake_image`` setting to contol how PostgreSQL will be started: if set
|
# Use ``bake_image`` setting to control how PostgreSQL will be started: if set
|
||||||
# to ``True`` the raw ``pg_ctl`` will be utilized instead of packaged init
|
# to ``True`` the raw ``pg_ctl`` will be utilized instead of packaged init
|
||||||
# script, job or unit run with Salt ``service`` state.
|
# script, job or unit run with Salt ``service`` state.
|
||||||
bake_image: True
|
bake_image: True
|
||||||
|
@ -62,7 +65,7 @@ postgres:
|
||||||
# Create/remove users, tablespaces, databases, schema and extensions.
|
# Create/remove users, tablespaces, databases, schema and extensions.
|
||||||
# Each of these dictionaries contains PostgreSQL entities which
|
# Each of these dictionaries contains PostgreSQL entities which
|
||||||
# mapped to the ``postgres_*`` Salt states with arguments. See the Salt
|
# mapped to the ``postgres_*`` Salt states with arguments. See the Salt
|
||||||
# documentaion to get all supported argument for a particular state.
|
# documentation to get all supported argument for a particular state.
|
||||||
#
|
#
|
||||||
# Format is the following:
|
# Format is the following:
|
||||||
#
|
#
|
||||||
|
|
|
@ -93,13 +93,17 @@ postgresql-conf:
|
||||||
postgresql-pg_hba:
|
postgresql-pg_hba:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: {{ postgres.conf_dir }}/pg_hba.conf
|
- name: {{ postgres.conf_dir }}/pg_hba.conf
|
||||||
- source: {{ postgres['pg_hba.conf'] }}
|
|
||||||
- template: jinja
|
|
||||||
- user: {{ postgres.user }}
|
- user: {{ postgres.user }}
|
||||||
- group: {{ postgres.group }}
|
- group: {{ postgres.group }}
|
||||||
- mode: 600
|
- mode: 600
|
||||||
|
{%- if postgres.acls %}
|
||||||
|
- source: {{ postgres['pg_hba.conf'] }}
|
||||||
|
- template: jinja
|
||||||
- defaults:
|
- defaults:
|
||||||
acls: {{ postgres.acls }}
|
acls: {{ postgres.acls }}
|
||||||
|
{%- else %}
|
||||||
|
- replace: False
|
||||||
|
{%- endif %}
|
||||||
- require:
|
- require:
|
||||||
- file: postgresql-config-dir
|
- file: postgresql-config-dir
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue