Skip to content
Snippets Groups Projects
Unverified Commit 3e20211d authored by Matthew X. Economou's avatar Matthew X. Economou
Browse files

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.
parent a55beda8
No related branches found
No related tags found
No related merge requests found
...@@ -30,8 +30,10 @@ include: ...@@ -30,8 +30,10 @@ include:
- name: /etc/mysql/{{ database }}.schema - name: /etc/mysql/{{ database }}.schema
- source: {{ salt['pillar.get'](['mysql', 'schema', database, 'source']|join(':')) }} - source: {{ salt['pillar.get'](['mysql', 'schema', database, 'source']|join(':')) }}
{%- set template_type = salt['pillar.get'](['mysql', 'schema', database, 'template']|join(':'), False) %} {%- 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 %} {%- if template_type %}
- template: {{ template_type }} - template: {{ template_type }}
- context: {{ template_context|yaml }}
{% endif %} {% endif %}
- user: {{ salt['pillar.get']('mysql:server:user', 'mysql') }} - user: {{ salt['pillar.get']('mysql:server:user', 'mysql') }}
- makedirs: True - makedirs: True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment