2016-09-09 11:36:26 +03:00
|
|
|
{%- from "postgres/map.jinja" import postgres with context -%}
|
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
{%- macro format_kwargs(kwarg) -%}
|
|
|
|
|
|
|
|
{%- filter indent(4) %}
|
|
|
|
{%- for k, v in kwarg|dictsort() %}
|
|
|
|
- {{ k }}: {{ v }}
|
|
|
|
{%- endfor %}
|
|
|
|
{%- endfilter %}
|
|
|
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
2016-09-09 11:36:26 +03:00
|
|
|
{%- macro format_state(name, state, kwarg) %}
|
|
|
|
|
|
|
|
{%- do kwarg.update({'name': name}) %}
|
|
|
|
{%- if 'ensure' in kwarg %}
|
|
|
|
{%- set ensure = kwarg.pop('ensure') %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- if 'user' not in kwarg and state != 'postgres_schema' %}
|
|
|
|
{%- do kwarg.update({'user': postgres.user}) %}
|
|
|
|
{%- endif -%}
|
|
|
|
|
|
|
|
{{ state }}-{{ name }}:
|
|
|
|
{{ state }}.{{ ensure|default('present') }}:
|
2016-09-20 15:44:49 +03:00
|
|
|
{{- format_kwargs(kwarg) }}
|
2018-06-08 23:40:12 +01:00
|
|
|
- db_port: {{ postgres.port|default(postgres.default_port) }}
|
2018-02-22 17:54:52 +02:00
|
|
|
- onchanges:
|
|
|
|
- test: postgres-reload-modules
|
2016-09-09 11:36:26 +03:00
|
|
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
# vim: ft=sls
|