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

1 Answers1

1

Looks like your yaml is wrong (= instead of :).

I'd study the docs for mysql_user (ansible-doc mysql_user) and check the examples to get an idea.

vrms
  • 269
  • 1
  • 4
  • 12