bertvv / ansible-role-mariadb

Install MariaDB on RHEL/CentOS 7 or Fedora.
https://galaxy.ansible.com/bertvv/mariadb/
Other
145 stars 108 forks source link

Update root pwd #46

Open grahamrhay opened 4 years ago

grahamrhay commented 4 years ago

Running v3.1 of the role with an old mariadb version, and a root pwd:

    - role: bertvv.mariadb
      become: yes 
      vars:
        mariadb_version: 10.1
        mariadb_root_password: ***

fails:

TASK [bertvv.mariadb : Check if a custom root password is specified] *************************************************************************************************************************
skipping: [gg-core-test-app-0]

TASK [bertvv.mariadb : Check if root password is unset] **************************************************************************************************************************************
fatal: [gg-core-test-app-0]: FAILED! => {"changed": false, "cmd": "mysql -u root -p'***' -h localhost -S /var/lib/mysql/mysql.sock -e \"quit\"\n", "delta": "0:00:00.017762", "end": "2020-11-05 11:01:53.457887", "msg": "non-zero return code", "rc": 1, "start": "2020-11-05 11:01:53.440125", "stderr": "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)", "stderr_lines": ["ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"], "stdout": "", "stdout_lines": []}
...ignoring

TASK [bertvv.mariadb : Check if the specified root password is already set] ******************************************************************************************************************
fatal: [gg-core-test-app-0]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

(and also logs the new root pwd, which isn't ideal)

It seems to have been caused by this change, which has inverted the behaviour of the task at L14. I tried removing L17, which got me a bit further. And I then had to add a login_user to the mysql_user tasks below. But I just ground to a halt on this task, and decided I should probably accept that I had no idea what I was doing.

I'd be happy to provide a PR, but I don't think I really understand the problem/solution well enough.

grahamrhay commented 4 years ago

I'm using v3.0 for now, which seems to work correctly for my scenario, but I'd prefer not to miss out on any improvements

chrisdeeming commented 4 years ago

Just wanted to add I'm also experiencing this with newer versions too - 10.3 specifically for this issue.

I need to try it again but 10.4 totally failed for other reasons.

grahamrhay commented 4 years ago

the auth changed in 10.4, so this will affect any version older than that:

https://github.com/bertvv/ansible-role-mariadb/blob/master/tasks/main.yml#L30