Closed randomorder closed 4 years ago
It seems ansible's interpreter discovery system is making ansible work with /usr/bin/python
, despite python3
being listed as the 'correct' version for our platform/distribution/version.
Detects the target OS platform, distribution, and version then consults a table listing the correct Python interpreter and path for each platform/distribution/version. If an entry is found, and /usr/bin/python is absent, uses the discovered interpreter (and path). If an entry is found, and /usr/bin/python is present, uses /usr/bin/python and issues a warning. This exception provides temporary compatibility with previous versions of Ansible that always defaulted to /usr/bin/python, so if you have installed Python and other dependencies at /usr/bin/python on some hosts, Ansible will find and use them with this setting...
This behaviour is going to be removed in a future ansible version (2.12), the new one will make us use python3.
New behaviour can be forced by setting interpreter_python = auto
in the .cfg, I have tested it but is leading to error such as:
fatal: [51.89.117.74]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (psycopg2) on ansible-machine's Python /usr/bin/python3. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
While running the task:
Create GeoServer DB in PostgreSQL
can you please try to install package python3-psycopg2
and test again?
Running the tasks with python3-psycopg2
gives no errors. Should we make these changes permanent?
Maybe tomorrow. Please move this issue to blocked for the moment and move on with next task
conf updated everything seems to be working fine
Please investigate on the following:
"[DEPRECATION WARNING]: Distribution Ubuntu 18.04 on host 51.89.175.192 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg."
Why is this reported / how can we work around it. Propose a solution