15 lines
590 B
YAML
15 lines
590 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 | default([]) }}'
|
|
when: 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 | default([]) }}'
|
|
- allowed_hosts
|
|
when: item.0.name is defined
|
|
tags: [ 'mysql', 'mysql_db' ]
|