|
|
|
|
|
|
|
|
|
|
|
|
|
|
{%- for database_name, database in server.get('database', {}).iteritems() %} |
|
|
{%- for database_name, database in server.get('database', {}).iteritems() %} |
|
|
|
|
|
|
|
|
{%- if not grains.get('noservices', False) %} |
|
|
|
|
|
mysql_database_{{ database_name }}: |
|
|
mysql_database_{{ database_name }}: |
|
|
mysql_database.present: |
|
|
mysql_database.present: |
|
|
- name: {{ database_name }} |
|
|
- name: {{ database_name }} |
|
|
|
|
|
|
|
|
#- connection_user: {{ connection.user }} |
|
|
#- connection_user: {{ connection.user }} |
|
|
#- connection_pass: {{ connection.password }} |
|
|
#- connection_pass: {{ connection.password }} |
|
|
#- connection_charset: {{ connection.charset }} |
|
|
#- connection_charset: {{ connection.charset }} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{%- if grains.get('noservices') %} |
|
|
|
|
|
- onlyif: /bin/false |
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{%- for user in database.users %} |
|
|
{%- for user in database.users %} |
|
|
{%- if not grains.get('noservices', False) %} |
|
|
|
|
|
mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }}: |
|
|
mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }}: |
|
|
mysql_user.present: |
|
|
mysql_user.present: |
|
|
- host: '{{ user.host }}' |
|
|
- host: '{{ user.host }}' |
|
|
|
|
|
|
|
|
#- connection_user: {{ connection.user }} |
|
|
#- connection_user: {{ connection.user }} |
|
|
#- connection_pass: {{ connection.password }} |
|
|
#- connection_pass: {{ connection.password }} |
|
|
#- connection_charset: {{ connection.charset }} |
|
|
#- connection_charset: {{ connection.charset }} |
|
|
|
|
|
{%- if grains.get('noservices') %} |
|
|
|
|
|
- onlyif: /bin/false |
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
mysql_grants_{{ user.name }}_{{ database_name }}_{{ user.host }}: |
|
|
mysql_grants_{{ user.name }}_{{ database_name }}_{{ user.host }}: |
|
|
mysql_grants.present: |
|
|
mysql_grants.present: |
|
|
|
|
|
|
|
|
- require: |
|
|
- require: |
|
|
- mysql_user: mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }} |
|
|
- mysql_user: mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }} |
|
|
- mysql_database: mysql_database_{{ database_name }} |
|
|
- mysql_database: mysql_database_{{ database_name }} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{%- if grains.get('noservices') %} |
|
|
|
|
|
- onlyif: /bin/false |
|
|
|
|
|
{%- endif %} |
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
|
|
|
|
|
|
{%- if database.initial_data is defined %} |
|
|
{%- if database.initial_data is defined %} |
|
|
|
|
|
|
|
|
#- connection_charset: {{ connection.charset }} |
|
|
#- connection_charset: {{ connection.charset }} |
|
|
- require: |
|
|
- require: |
|
|
- mysql_user_{{ user.name }}_{{ host }} |
|
|
- mysql_user_{{ user.name }}_{{ host }} |
|
|
- mysql_database_{{ db.database }} |
|
|
|
|
|
|
|
|
# the following line is not mandatory as database might not be managed by salt formula |
|
|
|
|
|
#- mysql_database_{{ db.database }} |
|
|
{%- if grains.get('noservices') %} |
|
|
{%- if grains.get('noservices') %} |
|
|
- onlyif: /bin/false |
|
|
- onlyif: /bin/false |
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{%- endif %} |