forked from ISTI-ansible-roles/ansible-roles
24 lines
627 B
YAML
24 lines
627 B
YAML
|
---
|
||
|
- name: Add databases to mysql, if any
|
||
|
mysql_db: name={{ item.name }} collation={{ item.collation }} encoding={{ item.encoding }} state=present
|
||
|
with_items: mysql_db_data
|
||
|
when:
|
||
|
- mysql_db_data is defined
|
||
|
- item.name is defined
|
||
|
tags:
|
||
|
- mysql
|
||
|
- mysql_db
|
||
|
|
||
|
- name: Add a user for the databases
|
||
|
mysql_user: name={{ item.0.user }} password={{ item.0.pwd }} host={{ item.1 }} priv={{ item.0.name }}.*:"{{ item.0.user_grant }}" state=present
|
||
|
with_subelements:
|
||
|
- mysql_db_data
|
||
|
- allowed_hosts
|
||
|
when:
|
||
|
- mysql_db_data is defined
|
||
|
- item.0.name is defined
|
||
|
tags:
|
||
|
- mysql
|
||
|
- mysql_db
|
||
|
|