mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-17 10:10:30 +00:00

In some MySQL server configurations (e.g., Amazon RDS), the root account may not be available. Instead, one may need to use a different account in order to perform database administration. This change replaced hard- coded references to the root account with a Pillar lookup that defaults to 'root'. Existing users of this formula should see no change in its behavior.
16 lines
566 B
Text
16 lines
566 B
Text
{% set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %}
|
|
{% set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %}
|
|
{% set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %}
|
|
|
|
include:
|
|
- mysql.python
|
|
|
|
mysql remove test database:
|
|
mysql_database.absent:
|
|
- name: test
|
|
- host: '{{ mysql_host }}'
|
|
- connection_user: '{{ mysql_root_user }}'
|
|
{% if mysql_root_pass %}
|
|
- connection_pass: '{{ mysql_root_pass }}'
|
|
{% endif %}
|
|
- connection_charset: utf8
|