ansible-playbooks
ansible-playbooks copied to clipboard
lemp_ubuntu1804 playbook ends with PyMySQL failure
This is how the playbook ends:
TASK [Sets the root password] ***************************************************************************************************** [WARNING]: Module did not set no_log for update_password fatal: [localhost]: FAILED! => {"changed": false, "msg": "The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required."}
RUNNING HANDLER [Reload Nginx] ****************************************************************************************************
PLAY RECAP ************************************************************************************************************************ localhost : ok=6 changed=5 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
The PyMySQL was already installed when the playbook finished:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pymysql is already the newest version (0.8.0-1).
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded. ```
@eran101 I was getting this same error as well. In vars/default.yml file I added ansible_python_interpreter: "/usr/bin/python3"
There was also a prior warning in the terminal "[DEPRECATION WARNING]: Distribution Ubuntu 18.04 on host default should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with prior Ansible releases."
In the playbook Ansible is installing "python3-pymysql" and using the python 2.7 interpreter to execute the package which is a python 3 package.
Telling Ansible to use the Python 3 interpreter fixed the error.
source: Interpreter Discovery