2036db938b
Remove the useless call for `cat` as `grep` take a file as it's second argument that tell it to search for the pattern in a specific file instead of whatever is passed to it through stdin. Name both task defining the position of the config directory for self-documentation purposes (and please ansible-lint defaults). Change role description to it's description in the readme instead of the default description asking for the role to be described. Don't compare to empty string, an empty string is already false while a non-empty string is true.
47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
---
|
|
|
|
- name: "Define the config directory of mysql"
|
|
set_fact:
|
|
mysql_config_directory: /etc/mysql/mariadb.conf.d
|
|
|
|
- name: "Copy MySQL defaults config file (Debian 9 or later)"
|
|
copy:
|
|
src: evolinux-defaults.cnf
|
|
dest: "{{ mysql_config_directory }}/{{ mysql_evolinux_defaults_file }}"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
force: yes
|
|
tags:
|
|
- mysql
|
|
|
|
- name: "Copy MySQL custom config file (Debian 9 or later)"
|
|
template:
|
|
src: evolinux-custom.cnf.j2
|
|
dest: "{{ mysql_config_directory }}/{{ mysql_evolinux_custom_file }}"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
force: "{{ mysql_force_custom_config }}"
|
|
tags:
|
|
- mysql
|
|
|
|
- name: "Create a system config directory for systemd overrides (Debian 9 or later)"
|
|
file:
|
|
path: /etc/systemd/system/mariadb.service.d
|
|
state: directory
|
|
|
|
- name: "Override MariaDB systemd unit (Debian 9 or later)"
|
|
template:
|
|
src: mariadb.systemd.j2
|
|
dest: /etc/systemd/system/mariadb.service.d/evolinux.conf
|
|
force: yes
|
|
register: mariadb_systemd_override
|
|
|
|
- name: reload systemd and restart MariaDB
|
|
systemd:
|
|
name: mysql
|
|
daemon_reload: yes
|
|
notify: "{{ mysql_restart_handler_name }}"
|
|
when: mariadb_systemd_override.changed
|