The Set MariaDB root password for the first time (root@localhost) task fails when a username and password is set for mysqladmin in the custom.cnf file.
Run the playbook again to check for idempotentcy. (I believe the error happens on the first run, but it will definitely happen on the second run after the root password is set.)
What is the current bug behavior?
An error message displays on the run of the playbook.
What is the expected correct behavior?
The playbook should succeed on every run of the playbook, even if the root password for mysqladmin is set in a .cnf config file.
Relevant logs and/or screenshots
The Check if root password is set task erroneously succeeds. (A root password is set, but this command still succeeds.
mysqladmin -u root status
The following task, Set MariaDB root password for the first time (root@localhost) fails because a password as already been set:
msg": "unable to connect to database, check login_user and login_password are correct or /root/.my.cnf has the credentials. Exception message: (1045, \"Access denied for user 'root'@'localhost' (using password: NO)\")"
Possible fixes
Please update the following task to detect if a root password is set without using the mysqladmin command:
# This command will succeed when the root password was set previously
- name: Check if root password is set
shell: >
mysql -u root
-p'{{ mariadb_root_password }}'
-h localhost
-S {{ mariadb_socket }}
-e "quit"
changed_when: false
ignore_errors: true
register: root_pwd_check
tags: mariadb
Also change the conditionals in these two lines:
line 28line 43
to:
when: root_pwd_check.rc != 0
I will make a merge request for this change shortly.
Summary
The
Set MariaDB root password for the first time (root@localhost)
task fails when a username and password is set for mysqladmin in the custom.cnf file.Steps to reproduce
NOTE: Make sure to update
<redacted>
with your root password.What is the current bug behavior?
An error message displays on the run of the playbook.
What is the expected correct behavior?
The playbook should succeed on every run of the playbook, even if the root password for mysqladmin is set in a
.cnf
config file.Relevant logs and/or screenshots
The
Check if root password is set
task erroneously succeeds. (A root password is set, but this command still succeeds.The following task,
Set MariaDB root password for the first time (root@localhost)
fails because a password as already been set:Possible fixes
Please update the following task to detect if a root password is set without using the
mysqladmin
command:Also change the conditionals in these two lines: line 28 line 43
to:
I will make a merge request for this change shortly.