Merge pull request #138 from irtnog/add-schema-context

Feature setting the template context from the mysql:schema pillar
This commit is contained in:
Forrest 2016-09-11 12:33:17 -07:00 committed by GitHub
commit 59fd786975
2 changed files with 16 additions and 0 deletions

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

View file

@ -55,6 +55,20 @@ mysql:
load: True
source: salt://mysql/files/baz.schema.tmpl
template: jinja
qux:
load: True
source: salt://mysql/files/qux.schema.tmpl
template: jinja
context:
encabulator: Turbo
girdlespring: differential
quux:
load: True
source: salt://mysql/files/qux.schema.tmpl
template: jinja
context:
encabulator: Retro
girdlespring: integral
# Manage users
# you can get pillar for existing server using scripts/import_users.py script