Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hba & servers settings control #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,30 @@ Single database server with empty database
host: 'localhost'
rights: 'all privileges'

With custom settings

.. code-block:: yaml

postgresql:
server:
...
settings:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't do it this way for a good reason. Rather structure the settings under postresql:server pillar directly. That will make pillars readable, structured etc. The formula user should not recognize whether it's value for config file, etc..

I personally would agree with kind of "generic" ad-hoc way to add additional settings that formula don't support, but as we don't have any described procedure for that, it will not pass other reviewers.

max_connections: 300
timezone: "'UTC'"
...

With custom hba records

.. code-block:: yaml

postgresql:
server:
...
hba_records:
- 'host all all 192.168.0.101/32 trust'
- 'host all all 0.0.0.0/0 md5'
...

Single database server with initial data

.. code-block:: yaml
Expand Down
5 changes: 5 additions & 0 deletions postgresql/files/8.4/postgresql.conf.Debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from "postgresql/map.jinja" import server with context -%}
{%- set settings = server.get('settings', {}) -%}
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
Expand Down Expand Up @@ -561,3 +562,7 @@ default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------

#custom_variable_classes = '' # list of custom variable class names

{%- for k, v in settings.items() %}
{{ k }} = {{ v }}
{%- endfor %}
5 changes: 5 additions & 0 deletions postgresql/files/8.4/postgresql.conf.RedHat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from "postgresql/map.jinja" import server with context -%}
{%- set settings = server.get('settings', {}) -%}
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
Expand Down Expand Up @@ -507,3 +508,7 @@ default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------

#custom_variable_classes = '' # list of custom variable class names

{%- for k, v in settings.items() %}
{{ k }} = {{ v }}
{%- endfor %}
5 changes: 5 additions & 0 deletions postgresql/files/9.1/postgresql.conf.Debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from "postgresql/map.jinja" import server with context -%}
{%- set settings = server.get('settings', {}) -%}
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
Expand Down Expand Up @@ -561,3 +562,7 @@ default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------

#custom_variable_classes = '' # list of custom variable class names

{%- for k, v in settings.items() %}
{{ k }} = {{ v }}
{%- endfor %}
5 changes: 5 additions & 0 deletions postgresql/files/9.3/postgresql.conf.Debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from "postgresql/map.jinja" import server with context -%}
{%- set settings = server.get('settings', {}) -%}
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
Expand Down Expand Up @@ -596,3 +597,7 @@ default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------

# Add settings for extensions here

{%- for k, v in settings.items() %}
{{ k }} = {{ v }}
{%- endfor %}
5 changes: 5 additions & 0 deletions postgresql/files/9.4/postgresql.conf.Debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from "postgresql/map.jinja" import server, cluster with context -%}
{%- set settings = server.get('settings', {}) -%}
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
Expand Down Expand Up @@ -624,3 +625,7 @@ default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------

# Add settings for extensions here

{%- for k, v in settings.items() %}
{{ k }} = {{ v }}
{%- endfor %}
5 changes: 5 additions & 0 deletions postgresql/files/9.5/postgresql.conf.Debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from "postgresql/map.jinja" import server, cluster with context -%}
{%- set settings = server.get('settings', {}) -%}
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
Expand Down Expand Up @@ -645,3 +646,7 @@ default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------

# Add settings for extensions here

{%- for k, v in settings.items() %}
{{ k }} = {{ v }}
{%- endfor %}
5 changes: 5 additions & 0 deletions postgresql/files/9.6/postgresql.conf.Debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from "postgresql/map.jinja" import server, cluster with context -%}
{%- set settings = server.get('settings', {}) -%}
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
Expand Down Expand Up @@ -665,3 +666,7 @@ default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------

# Add settings for extensions here

{%- for k, v in settings.items() %}
{{ k }} = {{ v }}
{%- endfor %}
5 changes: 5 additions & 0 deletions postgresql/files/pg_hba.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from "postgresql/map.jinja" import server, cluster with context -%}
{%- set hba_records = server.get('hba_records', []) -%}
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
Expand Down Expand Up @@ -129,3 +130,7 @@ host all all ::1/128 md5
#host replication postgres ::1/128 md5

{%- endif %}

{%- for record in hba_records %}
{{ record }}
{%- endfor %}
6 changes: 6 additions & 0 deletions tests/pillar/postgresql_server.sls
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ postgresql:
host: localhost
createdb: true
rights: all privileges
settings:
max_connections: 300
timezone: "'UTC'"
hba_records:
- 'host all all 192.168.0.101/32 trust'
- 'host all all 0.0.0.0/0 md5'