mysql-formula/mysql/remove_test_database.sls
Matthew X. Economou 524b6e981c Allow changing connection_user by setting the 'mysql:server:root_user' Pillar key
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.
2015-05-18 10:33:27 -04:00

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