1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.