--- - name: Add MariaDB Configuration File template: src: ../../mariadb/templates/mariadb.cnf dest: /etc/mysql/conf.d/jingrow.cnf owner: root group: root mode: 0644 - name: Restart MariaDB Service systemd: daemon_reload: true name: mysql state: restarted enabled: yes - name: Change MariaDB root Password for localhost mysql_user: # login_user: root config_file: /root/.my.cnf # login_password: "{{ mariadb_old_root_password }}" check_implicit_admin: yes name: root host: "{{ item }}" priv: "*.*:ALL,GRANT" password: "{{ mariadb_root_password }}" state: present with_items: - localhost - name: Add .my.cnf MariaDB Configuration File template: src: ../../mariadb/templates/my.cnf dest: /root/.my.cnf owner: root group: root mode: 0600 - name: Change MariaDB root Password for other hosts mysql_user: login_user: root login_password: "{{ mariadb_root_password }}" check_implicit_admin: yes name: root host: "{{ item }}" priv: "*.*:ALL,GRANT" password: "{{ mariadb_root_password }}" state: present with_items: - 127.0.0.1 - ::1 - "%"