Sample Header Ad - 728x90

MariaDB root password change using Ansible

1 vote
1 answer
1243 views
I had tried to change MariaDB root password using following Ansible script.
- name: Dump MySQL root Password
        debug:
          msg: "MySQL new Password : {{ mysql_pass }}"

      - name: Set MySQL root Password
        become: True
        mysql_user: 
          name=root
          host="localhost"
          password="{{ mysql_pass }}"
          check_implicit_admin=yes
          login_user="root"
          login_password=""
          state=present
In my /etc/ansible/hosts
[myhosts:vars]
mysql_pass=mynewpassword
As I was told password variable may not be taken, I added debug/msg step.
TASK [Dump MySQL root Password] ********************************************************************************************************************************
ok: [vizua@node1] => {
    "msg": "MySQL new Password : mynewpassword"
}
Similar issue discussed here . Thats where I got Password changing steps. This step runs without error, showing changed, but yet I can access without password or any password. MariaDB : Server version: 10.1.47-MariaDB-0ubuntu0.18.04.1 Ansible : ansible 2.5.1
Asked by Sachith Muhandiram (111 rep)
Dec 31, 2020, 11:40 AM
Last activity: Jan 18, 2022, 03:34 PM