mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-17 10:10:30 +00:00
20 lines
576 B
Text
20 lines
576 B
Text
{% from "mysql/map.jinja" import mysql with context %}
|
|
|
|
{% set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %}
|
|
{% set db_states = [] %}
|
|
|
|
include:
|
|
- mysql.python
|
|
|
|
{% for database in salt['pillar.get']('mysql:database', []) %}
|
|
{% set state_id = 'mysql_db_' ~ loop.index0 %}
|
|
{{ state_id }}:
|
|
mysql_database.present:
|
|
- name: {{ database }}
|
|
- host: localhost
|
|
- connection_user: root
|
|
- connection_pass: '{{ mysql_root_pass }}'
|
|
- connection_charset: utf8
|
|
|
|
{% do db_states.append(state_id) %}
|
|
{% endfor %}
|