Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mysql-formula
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
salt
mysql-formula
Commits
ef312bc5
Commit
ef312bc5
authored
Jul 27, 2014
by
Brandon Matthews
Browse files
Options
Downloads
Patches
Plain Diff
clever way to load DB schemas in 2014.1
parent
79fe88b4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mysql/database.sls
+15
-0
15 additions, 0 deletions
mysql/database.sls
pillar.example
+6
-0
6 additions, 0 deletions
pillar.example
with
21 additions
and
0 deletions
mysql/database.sls
+
15
−
0
View file @
ef312bc5
...
@@ -16,5 +16,20 @@ include:
...
@@ -16,5 +16,20 @@ include:
- connection_pass: '{{ mysql_root_pass }}'
- connection_pass: '{{ mysql_root_pass }}'
- connection_charset: utf8
- 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) %}
{% do db_states.append(state_id) %}
{% endfor %}
{% endfor %}
This diff is collapsed.
Click to expand it.
pillar.example
+
6
−
0
View file @
ef312bc5
...
@@ -9,6 +9,12 @@ mysql:
...
@@ -9,6 +9,12 @@ mysql:
database:
database:
- foo
- foo
- bar
- bar
schema:
foo:
load: True
source: salt://mysql/files/foo.schema
bar:
load: False
# Manage users
# Manage users
user:
user:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment