Skip to content

Commit 88d68aa

Browse files
committed
Error log code cleanup
1 parent 3ef3b33 commit 88d68aa

1 file changed

Lines changed: 18 additions & 26 deletions

File tree

tasks/configure.yml

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -57,43 +57,35 @@
5757
state: directory
5858
owner: mysql
5959
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
60+
mode: "0755"
61+
when:
62+
- mysql_log_error | default('') | length > 0
63+
- mysql_log_error != 'syslog'
6864

69-
- name: Set ownership on slow query log file (if configured).
65+
- name: Ensure slow query log file exists and has correct permissions
7066
ansible.builtin.file:
7167
path: "{{ mysql_slow_query_log_file }}"
72-
state: file
68+
state: touch
7369
owner: mysql
7470
group: "{{ mysql_log_file_group }}"
75-
mode: 0640
76-
when: mysql_slow_query_log_enabled
77-
78-
- name: Create error log file (if configured).
79-
ansible.builtin.command: "touch {{ mysql_log_error }}"
80-
args:
81-
creates: "{{ mysql_log_error }}"
82-
when:
83-
- ((mysql_log is defined) and (mysql_log | length > 0)) | default(true)
84-
- ((mysql_log_error is defined) and (mysql_log_error | length > 0)) | default(true)
85-
tags: ['skip_ansible_galaxy']
71+
mode: "0640"
72+
modification_time: preserve
73+
access_time: preserve
74+
when: mysql_slow_query_log_enabled | bool
8675

87-
- name: Set ownership on error log file (if configured).
76+
- name: Ensure error log file exists and has correct permissions
8877
ansible.builtin.file:
8978
path: "{{ mysql_log_error }}"
90-
state: file
79+
state: touch
9180
owner: mysql
9281
group: "{{ mysql_log_file_group }}"
93-
mode: 0640
82+
mode: "0640"
83+
modification_time: preserve
84+
access_time: preserve
9485
when:
95-
- ((mysql_log is defined) and (mysql_log | length > 0)) | default(true)
96-
- ((mysql_log_error is defined) and (mysql_log_error | length > 0)) | default(true)
86+
- mysql_log | default('') | length > 0
87+
- mysql_log_error | default('') | length > 0
88+
- mysql_log_error != 'syslog'
9789
tags: ['skip_ansible_galaxy']
9890

9991
- name: Ensure MySQL is started and enabled on boot.

0 commit comments

Comments
 (0)