2022-05-09 20:26:15 +03:00
|
|
|
---
|
|
|
|
|
|
|
|
- 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
|
2022-05-09 20:53:21 +03:00
|
|
|
template:
|
2022-05-09 20:26:15 +03:00
|
|
|
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
|