diff --git a/README.rst b/README.rst index 60738f8..8deba66 100644 --- a/README.rst +++ b/README.rst @@ -43,6 +43,30 @@ Single database server with empty database host: 'localhost' rights: 'all privileges' +With custom settings + +.. code-block:: yaml + + postgresql: + server: + ... + settings: + 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 diff --git a/postgresql/files/8.4/postgresql.conf.Debian b/postgresql/files/8.4/postgresql.conf.Debian index baef22a..d6df7e1 100644 --- a/postgresql/files/8.4/postgresql.conf.Debian +++ b/postgresql/files/8.4/postgresql.conf.Debian @@ -1,4 +1,5 @@ {%- from "postgresql/map.jinja" import server with context -%} +{%- set settings = server.get('settings', {}) -%} # ----------------------------- # PostgreSQL configuration file # ----------------------------- @@ -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 %} diff --git a/postgresql/files/8.4/postgresql.conf.RedHat b/postgresql/files/8.4/postgresql.conf.RedHat index f3b3ef2..bb22008 100644 --- a/postgresql/files/8.4/postgresql.conf.RedHat +++ b/postgresql/files/8.4/postgresql.conf.RedHat @@ -1,4 +1,5 @@ {%- from "postgresql/map.jinja" import server with context -%} +{%- set settings = server.get('settings', {}) -%} # ----------------------------- # PostgreSQL configuration file # ----------------------------- @@ -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 %} diff --git a/postgresql/files/9.1/postgresql.conf.Debian b/postgresql/files/9.1/postgresql.conf.Debian index 02f65c9..4a976cf 100644 --- a/postgresql/files/9.1/postgresql.conf.Debian +++ b/postgresql/files/9.1/postgresql.conf.Debian @@ -1,4 +1,5 @@ {%- from "postgresql/map.jinja" import server with context -%} +{%- set settings = server.get('settings', {}) -%} # ----------------------------- # PostgreSQL configuration file # ----------------------------- @@ -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 %} diff --git a/postgresql/files/9.3/postgresql.conf.Debian b/postgresql/files/9.3/postgresql.conf.Debian index 45eb96c..519c8eb 100644 --- a/postgresql/files/9.3/postgresql.conf.Debian +++ b/postgresql/files/9.3/postgresql.conf.Debian @@ -1,4 +1,5 @@ {%- from "postgresql/map.jinja" import server with context -%} +{%- set settings = server.get('settings', {}) -%} # ----------------------------- # PostgreSQL configuration file # ----------------------------- @@ -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 %} diff --git a/postgresql/files/9.4/postgresql.conf.Debian b/postgresql/files/9.4/postgresql.conf.Debian index e43fc6f..5cb55cc 100644 --- a/postgresql/files/9.4/postgresql.conf.Debian +++ b/postgresql/files/9.4/postgresql.conf.Debian @@ -1,4 +1,5 @@ {%- from "postgresql/map.jinja" import server, cluster with context -%} +{%- set settings = server.get('settings', {}) -%} # ----------------------------- # PostgreSQL configuration file # ----------------------------- @@ -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 %} diff --git a/postgresql/files/9.5/postgresql.conf.Debian b/postgresql/files/9.5/postgresql.conf.Debian index 1dee134..6fdaeae 100644 --- a/postgresql/files/9.5/postgresql.conf.Debian +++ b/postgresql/files/9.5/postgresql.conf.Debian @@ -1,4 +1,5 @@ {%- from "postgresql/map.jinja" import server, cluster with context -%} +{%- set settings = server.get('settings', {}) -%} # ----------------------------- # PostgreSQL configuration file # ----------------------------- @@ -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 %} diff --git a/postgresql/files/9.6/postgresql.conf.Debian b/postgresql/files/9.6/postgresql.conf.Debian index e0fce11..32c639c 100644 --- a/postgresql/files/9.6/postgresql.conf.Debian +++ b/postgresql/files/9.6/postgresql.conf.Debian @@ -1,4 +1,5 @@ {%- from "postgresql/map.jinja" import server, cluster with context -%} +{%- set settings = server.get('settings', {}) -%} # ----------------------------- # PostgreSQL configuration file # ----------------------------- @@ -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 %} diff --git a/postgresql/files/pg_hba.conf b/postgresql/files/pg_hba.conf index a1f1eb8..d07b639 100644 --- a/postgresql/files/pg_hba.conf +++ b/postgresql/files/pg_hba.conf @@ -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 # =================================================== # @@ -129,3 +130,7 @@ host all all ::1/128 md5 #host replication postgres ::1/128 md5 {%- endif %} + +{%- for record in hba_records %} +{{ record }} +{%- endfor %} diff --git a/tests/pillar/postgresql_server.sls b/tests/pillar/postgresql_server.sls index 0cf7f27..ba39a5b 100644 --- a/tests/pillar/postgresql_server.sls +++ b/tests/pillar/postgresql_server.sls @@ -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'