--- - name: install mariadb apt: pkg: - mariadb-server - python3-mysqldb - name: deploy mariadb config notify: restart mariadb template: src: 50-server.cnf.j2 dest: /etc/mysql/mariadb.conf.d/50-server.cnf mode: "0644" owner: root group: root - name: create mariadb dbs mysql_db: login_unix_socket: /var/run/mysqld/mysqld.sock name: "{{ item.key }}" collation: "{{ item.value.collation | default('utf8mb4_unicode_ci') }}" encoding: "{{ item.value.encoding | default('utf8mb4') }}" with_dict: "{{ mariadb.dbs }}" - name: create mariadb users no_log: True mysql_user: login_unix_socket: /var/run/mysqld/mysqld.sock name: "{{ item.key }}" host: "{{ item.value.host | default('localhost') }}" password: "{{ item.value.password | default(omit) }}" plugin: "{{ item.value.plugin | default(omit) }}" priv: "{{ item.value.priv | default('*.*:USAGE') }}" with_dict: "{{ mariadb.users }}" - include_tasks: backup.yml when: - mariadb.backup.enable