2015-05-29 19:42:43 +02:00
|
|
|
---
|
|
|
|
- name: Add databases to mysql, if any
|
|
|
|
mysql_db: name={{ item.name }} collation={{ item.collation }} encoding={{ item.encoding }} state=present
|
2016-03-17 21:35:04 +01:00
|
|
|
with_items: '{{ mysql_db_data | default([]) }}'
|
|
|
|
when: item.name is defined
|
2015-08-24 15:56:46 +02:00
|
|
|
tags: [ 'mysql', 'mysql_db' ]
|
2015-05-29 19:42:43 +02:00
|
|
|
|
|
|
|
- name: Add a user for the databases
|
2016-03-17 21:35:04 +01:00
|
|
|
mysql_user: name={{ item.0.user }} password={{ item.0.pwd }} host={{ item.1 }} priv="{{ item.0.name }}.*:{{ item.0.user_grant }}" state=present
|
2015-05-29 19:42:43 +02:00
|
|
|
with_subelements:
|
2016-03-17 21:35:04 +01:00
|
|
|
- '{{ mysql_db_data | default([]) }}'
|
2015-05-29 19:42:43 +02:00
|
|
|
- allowed_hosts
|
2016-03-17 21:35:04 +01:00
|
|
|
when: item.0.name is defined
|
2015-08-24 15:56:46 +02:00
|
|
|
tags: [ 'mysql', 'mysql_db' ]
|