50 lines
1.2 KiB
YAML
50 lines
1.2 KiB
YAML
---
|
|
|
|
- name: MySQL | Install packages
|
|
package:
|
|
name: "{{ mysql_packages }}"
|
|
state: present
|
|
|
|
- name: MySQL | Deploy main config
|
|
template:
|
|
src: "{{ mysql_main_conf.src }}"
|
|
dest: "{{ mysql_main_conf.dest }}"
|
|
mode: "{{ mysql_configs_mode }}"
|
|
owner: "{{ mysql_configs_user }}"
|
|
group: "{{ mysql_configs_user }}"
|
|
when: mysql_main_conf.src is defined
|
|
notify: MySQL | Restart
|
|
|
|
- name: MySQL | Deploy conf.d files
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ mysql_configs_mode }}"
|
|
owner: "{{ mysql_configs_user }}"
|
|
group: "{{ mysql_configs_user }}"
|
|
with_items: "{{ mysql_confd }}"
|
|
notify: MySQL | Restart
|
|
|
|
- name: MySQL | Enable and start
|
|
service:
|
|
name: "{{ mysql_service_name }}"
|
|
state: started
|
|
enables: yes
|
|
|
|
- name: MySQL | Create databases
|
|
mysql_db:
|
|
name: "{{ item.name }}"
|
|
state: "{{ item.state | d(omit) }}"
|
|
with_items: "{{ mysql_databases }}"
|
|
|
|
- name: MySQL | Create users
|
|
mysql_user:
|
|
name: "{{ item.name }}"
|
|
state: "{{ item.state | d(omit) }}"
|
|
password: "{{ item.password | d(omit) }}"
|
|
priv: "{{ item.priv | d(omit) }}"
|
|
with_items: "{{ mysql_users }}"
|
|
|
|
- name: unbound | Run handlers
|
|
meta: flush_handlers
|