Map Pillar dicts for PostgreSQL entities to the Salt state arguments

This commit is contained in:
Denys Havrysh
2016-09-09 11:36:26 +03:00
parent dd0be32810
commit 8c4dc07467
6 changed files with 152 additions and 200 deletions

21
postgres/macros.jinja Normal file
View File

@@ -0,0 +1,21 @@
{%- from "postgres/map.jinja" import postgres with context -%}
{%- 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') }}:
{%- for k, v in kwarg|dictsort() %}
- {{ k }}: {{ v }}
{%- endfor %}
{%- endmacro %}
# vim: ft=sls