2022-08-30 12:48:38 +00:00
|
|
|
---
|
|
|
|
- name: gather OS distribution version specific variables
|
2022-08-31 03:19:06 +00:00
|
|
|
ansible.builtin.include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
2022-08-30 12:48:38 +00:00
|
|
|
|
|
|
|
- name: gather OS distribution specific variables
|
2022-08-31 03:19:06 +00:00
|
|
|
ansible.builtin.include_vars: "{{ ansible_distribution }}.yaml"
|
2022-08-30 12:48:38 +00:00
|
|
|
|
|
|
|
- name: gather OS family specific variables
|
2022-08-31 03:19:06 +00:00
|
|
|
ansible.builtin.include_vars: "{{ ansible_os_family }}.yaml"
|
2022-08-30 12:48:38 +00:00
|
|
|
|
|
|
|
- name: manage mysql package
|
|
|
|
package:
|
|
|
|
name: "{{ mysql_package_name }}"
|
|
|
|
state: "{{ mysql_package_state }}"
|
|
|
|
|
|
|
|
- name: create datadir
|
|
|
|
file:
|
|
|
|
path: "{{ mysql_config.mysqld.datadir }}"
|
|
|
|
owner: "{{ mysql_datadir_owner }}"
|
|
|
|
group: "{{ mysql_datadir_group }}"
|
|
|
|
mode: "{{ mysql_datadir_mode }}"
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: initialize mysql
|
|
|
|
command: "mysqld --initialize --log-error={{ mysql_initialize_log_error }}"
|
|
|
|
args:
|
|
|
|
creates: "{{ mysql_config.mysqld.datadir }}/mysql"
|
|
|
|
|
|
|
|
- name: configure mysql
|
|
|
|
template:
|
|
|
|
src: my.cnf.j2
|
|
|
|
dest: "{{ mysql_cfg_path }}"
|
|
|
|
notify: restart mysql
|
|
|
|
|
|
|
|
- name: manage mysql service
|
|
|
|
service:
|
|
|
|
name: "{{ mysql_service_name }}"
|
|
|
|
state: "{{ mysql_service_state }}"
|
|
|
|
enabled: "{{ mysql_service_enabled }}"
|