Skip to content

Commit 0ef5936

Browse files
committed
Fix logfile creation
1 parent 4a1f2cf commit 0ef5936

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

tasks/configure.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@
4242
with_items: "{{ mysql_config_include_files }}"
4343
notify: restart mysql
4444

45-
- name: Create slow query log file (if configured).
46-
ansible.builtin.command: "touch {{ mysql_slow_query_log_file }}"
47-
args:
48-
creates: "{{ mysql_slow_query_log_file }}"
49-
when: mysql_slow_query_log_enabled
50-
5145
- name: Create datadir if it does not exist
5246
ansible.builtin.file:
5347
path: "{{ mysql_datadir }}"
@@ -57,6 +51,21 @@
5751
mode: 0755
5852
setype: mysqld_db_t
5953

54+
- name: Ensure error log directory exists
55+
ansible.builtin.file:
56+
path: "{{ mysql_log_error | dirname }}"
57+
state: directory
58+
owner: mysql
59+
group: "{{ mysql_log_file_group }}"
60+
mode: 0755
61+
when: mysql_log_error is defined and mysql_log_error | length > 0
62+
63+
- name: Create slow query log file (if configured).
64+
ansible.builtin.command: "touch {{ mysql_slow_query_log_file }}"
65+
args:
66+
creates: "{{ mysql_slow_query_log_file }}"
67+
when: mysql_slow_query_log_enabled
68+
6069
- name: Set ownership on slow query log file (if configured).
6170
ansible.builtin.file:
6271
path: "{{ mysql_slow_query_log_file }}"

0 commit comments

Comments
 (0)