mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-17 10:10:30 +00:00
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:
parent
a55beda83f
commit
3e20211d72
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue