bertvv / ansible-role-mariadb

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

Fails when playbook is running with --check #29

Closed chriscowley closed 4 years ago

chriscowley commented 5 years ago

When running ansible-playbook --check fails when this role is activated.

TASK [bertvv.mariadb : Set MariaDB root password for the first time (root@localhost)] *************************************************************************
fatal: [<hostname>]: FAILED! => {"msg": "The conditional check 'root_pwd_check.rc == 0' failed. The error was: error while evaluating conditional (root_pwd_check.rc == 0): 'dict object' has no attribute 'rc'\n\nThe error appears to be in '/home/ccowley/electricwebsites/ansible/roles/bertvv.mariadb/tasks/root-password.yml': line 21, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set MariaDB root password for the first time (root@localhost)\n  ^ here\n"}

The task Check if root password is set is not setting root_pwd_check, so the condition to stop it pretending to set the root password is in the wrong format, so the test fails, even though it will run fine when the playbook is run for true. Obviously this makes it impossible to do a proper dry-run of the playbook

bertvv commented 4 years ago

I don't really have a solution for this. This problem also occurs with the package installation. One task installs the MariaDB repository, another task installs the packages. The latter task will fail in --check mode since the package to be installed is not in the repositories. Later tasks like mysql_user would probably also fail in --check mode since no database will be installed at that time.