Closed dmitvitalii closed 2 years ago
Found a workaround:
tasks:
- block:
# ...
vars:
postgresql_apt_py2_dependencies: []
But it looks like it shouldn't be searching for py2 dependencies on Ubuntu 20.04 at all
@dmitvitalii
Had the same problem, also on Ubuntu 20.04, but you don't have to modify the code.
postgresql_apt_py3_dependencies: ["python3-psycopg2", "locales"]
postgresql_apt_py2_dependencies: ["python-psycopg2", "python-pycurl", "locales"]
postgresql_apt_dependencies: "{{ postgresql_apt_py3_dependencies if 👉'python3'👈 in ansible_python_interpreter|default('') else postgresql_apt_py2_dependencies }}"
So it appears you just need to tell ANXS.postgresql that it is dealing with python 3 and will pick the python3 dependencies, not python2's.
Now, ansible_python_interpreter
appears quite a bit in the yamls but I figured all I needed to do was to have python3
in it for this role.
- role: ANXS.postgresql
become: yes
vars:
#try to convince not to look for python 2 stuff...
#👇 (that's the python on my Ubuntu VM)
ansible_python_interpreter: "/usr/bin/python3"
and it worked.
btw, if your v3 python is not named python3
, but just plain python
, I'd first try to put in a bogus python3 name, in case it doesn't need it for anything else. Or I'd symlink python -> python3 and use that.
This is more a support case than a bug request.
By ensuring you use python3, you get rid of it. On those environments, you should use python3 anyways.
It's a bug request because it misidentifies what is python3
this is a bug dependencies line line shoud be
postgresql_apt_dependencies: "{{ postgresql_apt_py3_dependencies if ansible_python.version.major == 3 else postgresql_apt_py2_dependencies }}"
this way it's independent of ansible_python_interpreter
Facing the error on Ubuntu 20.04
I tried to install psycopg2-binary and psycopg2 using pre_tasks, but none of them work.
Full traceback
Installing
"python3-psycopg2"
didn't help either