diff --git a/roles/database_server/tasks/main.yml b/roles/database_server/tasks/main.yml index a6fbdd5e9c5804e839728e92b8a2d51da15fc5fb..706f29de184ef79aae6fd4dc0f8947d3abc692bc 100644 --- a/roles/database_server/tasks/main.yml +++ b/roles/database_server/tasks/main.yml @@ -53,6 +53,26 @@ path: "/root/.my.cnf" state: absent +- name: Check if Debian system maintenance configuration file uses dedicated user + command: "grep -q 'user.*=.*root' /etc/mysql/debian.cnf" + register: debian_maintenance_configuration_uses_root + failed_when: false + changed_when: false + +- name: Deploy Debian system maintenance configuration file that uses root account + copy: + src: "debian.cnf" + dest: "/etc/mysql/debian.cnf" + owner: root + group: root + mode: 0600 + when: "debian_maintenance_configuration_uses_root.rc != 0" + +- name: Drop the dedicated Debian system maintenance user + mysql_user: + name: "debian-sys-maint" + state: absent + - name: Set UTF-8 encoding as default for MariaDB copy: src: "utf8.cnf"