2019-12-02 14:55:41 +01:00
|
|
|
{%- from tpldir ~ '/database.sls' import db_states with context %}
|
|
|
|
{%- from tpldir ~ '/user.sls' import user_states with context %}
|
2014-07-01 15:18:54 -04:00
|
|
|
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- macro requisites(type, states) %}
|
2014-07-01 15:18:54 -04:00
|
|
|
{%- for state in states %}
|
|
|
|
- {{ type }}: {{ state }}
|
|
|
|
{%- endfor -%}
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- endmacro %}
|
2014-07-01 15:18:54 -04:00
|
|
|
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- set mysql_dev = salt['pillar.get']('mysql:dev:install', False) %}
|
|
|
|
{%- set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', False) %}
|
2014-12-12 09:20:09 +11:00
|
|
|
|
2014-07-01 15:18:54 -04:00
|
|
|
include:
|
2018-05-18 13:40:36 +02:00
|
|
|
- .server
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- if mysql_salt_user %}
|
2018-05-18 13:40:36 +02:00
|
|
|
- .salt-user
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- endif %}
|
2018-05-18 13:40:36 +02:00
|
|
|
- .database
|
|
|
|
- .user
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- if mysql_dev %}
|
2018-05-18 13:40:36 +02:00
|
|
|
- .dev
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- endif %}
|
2015-10-05 21:44:20 +02:00
|
|
|
|
2014-07-01 15:18:54 -04:00
|
|
|
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- if (db_states|length() + user_states|length()) > 0 %}
|
2014-07-01 15:18:54 -04:00
|
|
|
extend:
|
2018-12-09 00:34:58 +01:00
|
|
|
mysqld-service-running:
|
2014-07-01 15:18:54 -04:00
|
|
|
service:
|
|
|
|
- require_in:
|
2014-07-01 15:32:32 -04:00
|
|
|
{{ requisites('mysql_database', db_states) }}
|
|
|
|
{{ requisites('mysql_user', user_states) }}
|
2019-12-02 14:55:41 +01:00
|
|
|
{%- endif %}
|