mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-16 01:30:25 +00:00
Merge pull request #27 from thenewwazoo/schema_load
clever way to load DB schemas in 2014.1
This commit is contained in:
commit
f5bebe3d38
2 changed files with 21 additions and 0 deletions
|
@ -16,5 +16,20 @@ include:
|
|||
- connection_pass: '{{ mysql_root_pass }}'
|
||||
- connection_charset: utf8
|
||||
|
||||
{% if salt['pillar.get'](['mysql', 'schema', database, 'load']|join(':'), False) %}
|
||||
{{ state_id }}_schema:
|
||||
file.managed:
|
||||
- name: /etc/mysql/{{ database }}.schema
|
||||
- source: {{ salt['pillar.get'](['mysql', 'schema', database, 'source']|join(':')) }}
|
||||
- user: {{ salt['pillar.get']('mysql:server:user', 'mysql') }}
|
||||
|
||||
{{ state_id }}_load:
|
||||
cmd.wait:
|
||||
- name: mysql -u root -p{{ mysql_root_pass }} {{ database }} < /etc/mysql/{{ database }}.schema
|
||||
- watch:
|
||||
- file: {{ state_id }}_schema
|
||||
- mysql_database: {{ state_id }}
|
||||
{% endif %}
|
||||
|
||||
{% do db_states.append(state_id) %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -9,6 +9,12 @@ mysql:
|
|||
database:
|
||||
- foo
|
||||
- bar
|
||||
schema:
|
||||
foo:
|
||||
load: True
|
||||
source: salt://mysql/files/foo.schema
|
||||
bar:
|
||||
load: False
|
||||
|
||||
# Manage users
|
||||
user:
|
||||
|
|
Loading…
Add table
Reference in a new issue