Feature setting the template context from the mysql:schema pillar

This simplifies how schema files can be templated, especially when using
the same template to set up multiple databases on the same server.
This commit is contained in:
Matthew X. Economou 2016-09-11 06:09:59 -04:00
parent a55beda83f
commit 3e20211d72
No known key found for this signature in database
GPG key ID: 79A74A5561687230

View file

@ -30,8 +30,10 @@ include:
- name: /etc/mysql/{{ database }}.schema
- source: {{ salt['pillar.get'](['mysql', 'schema', database, 'source']|join(':')) }}
{%- set template_type = salt['pillar.get'](['mysql', 'schema', database, 'template']|join(':'), False) %}
{%- set template_context = salt['pillar.get'](['mysql', 'schema', database, 'context']|join(':'), {}) %}
{%- if template_type %}
- template: {{ template_type }}
- context: {{ template_context|yaml }}
{% endif %}
- user: {{ salt['pillar.get']('mysql:server:user', 'mysql') }}
- makedirs: True