2014-11-08 22:10:49 +01:00
|
|
|
---
|
|
|
|
- name: Copy my.cnf global MySQL configuration.
|
|
|
|
template:
|
|
|
|
src: my.cnf.j2
|
2015-01-09 00:20:30 +01:00
|
|
|
dest: "{{ mysql_config_file }}"
|
2014-11-08 22:10:49 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2015-04-10 15:20:00 +02:00
|
|
|
force: "{{ overwrite_global_mycnf }}"
|
2014-11-08 22:10:49 +01:00
|
|
|
notify: restart mysql
|
|
|
|
|
2015-12-16 19:50:16 +01:00
|
|
|
- name: Verify mysql include directory exists.
|
|
|
|
file:
|
|
|
|
path: "{{ mysql_config_include_dir }}"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
2015-12-16 22:12:02 +01:00
|
|
|
when: mysql_config_include_files | length
|
2015-12-16 19:50:16 +01:00
|
|
|
|
|
|
|
- name: Copy my.cnf override files into include directory.
|
|
|
|
template:
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ mysql_config_include_dir }}/{{ item.src | basename }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2015-12-16 22:12:02 +01:00
|
|
|
force: "{{ item.force | default(False) }}"
|
2016-02-29 06:37:00 +01:00
|
|
|
with_items: "{{ mysql_config_include_files }}"
|
2015-12-16 19:50:16 +01:00
|
|
|
notify: restart mysql
|
|
|
|
|
2015-04-24 19:20:27 +02:00
|
|
|
- name: Create slow query log file (if configured).
|
2016-04-15 17:06:22 +02:00
|
|
|
shell: "touch {{ mysql_slow_query_log_file }} creates={{ mysql_slow_query_log_file }}"
|
2015-04-24 19:20:27 +02:00
|
|
|
when: mysql_slow_query_log_enabled
|
|
|
|
|
|
|
|
- name: Set ownership on slow query log file (if configured).
|
|
|
|
file:
|
|
|
|
path: "{{ mysql_slow_query_log_file }}"
|
|
|
|
state: file
|
|
|
|
owner: mysql
|
|
|
|
group: mysql
|
|
|
|
mode: 0644
|
|
|
|
when: mysql_slow_query_log_enabled
|
|
|
|
|
2016-04-22 20:38:19 +02:00
|
|
|
- name: Create error log file (if configured).
|
|
|
|
shell: "touch {{ mysql_log_error }} creates={{ mysql_log_error }}"
|
|
|
|
when: mysql_log == "" and mysql_log_error != ""
|
|
|
|
|
|
|
|
- name: Set ownership on error log file (if configured).
|
|
|
|
file:
|
|
|
|
path: "{{ mysql_log_error }}"
|
|
|
|
state: file
|
|
|
|
owner: mysql
|
|
|
|
group: mysql
|
|
|
|
mode: 0644
|
|
|
|
when: mysql_slow_query_log_enabled
|
|
|
|
|
2014-11-08 22:10:49 +01:00
|
|
|
- name: Ensure MySQL is started and enabled on boot.
|
2015-01-07 17:28:09 +01:00
|
|
|
service: "name={{ mysql_daemon }} state=started enabled={{ mysql_enabled_on_startup }}"
|
2015-10-02 05:35:39 +02:00
|
|
|
register: mysql_service_configuration
|