- name: Install MariaDB packages apt: name: mariadb-server state: present #install_recommends: no - name: Ensure log directory exists /var/log/mysql file: path: /var/log/mysql state: directory owner: mysql group: adm mode: u=rwx,g=rxs,o= - name: Ensure mysqlbin directory exists /mnt/mysqlbin file: path: /mnt/mysqlbin state: directory owner: root group: root mode: u=rwx,g=rx,o=rx - name: Ensure mysqltmp directory exists /mnt/mysqltmp with sticky bit file: path: /mnt/mysqltmp state: directory mode: u=rwx,g=rwx,o=rwxt owner: root group: root - name: Set MariaDB custom configuration copy: src: "{{ item }}" dest: /etc/mysql/mariadb.conf.d/ owner: root group: root mode: u=rw,g=r,o=r with_fileglob: - "files/z9*.cnf" notify: restart-mariadb - name: Ensure mariadb service override directory exists file: path: /etc/systemd/system/mariadb.service.d state: directory owner: root group: root mode: u=rwx,g=rx,o=rx - name: Set MariaDB custom service.d override.conf copy: src: mariadb_override.conf dest: /etc/systemd/system/mariadb.service.d/override.conf owner: root group: root mode: u=rw,g=r,o=r notify: reload systemd - name: Ensure scripts root directory exists file: path: /root/scripts state: directory owner: root group: root mode: u=rwx,g=rx,o=rx - name: Set MariaDB custom root scripts copy: src: "{{ item }}" dest: /root/scripts/ owner: root group: root mode: u=rwx,g=rx,o=rx with_fileglob: - "files/scripts/*.sh" - name: Set MariaDB README root script copy: src: files/scripts/README.md dest: /root/scripts/README.md owner: root group: root mode: u=rw,g=r,o=r - name: Set MariaDB performance and customize root script copy: src: files/scripts/mysqltuner.pl dest: /root/scripts/mysqltuner.pl owner: root group: root mode: u=rwx,g=rx,o=rx - name: Set MariaDB Cron to /etc/cron.d template: src: templates/cron_mariadb dest: /etc/cron.d/vn owner: root group: root mode: u=rw,g=r,o=r