Skip to content

Commit

Permalink
Fix python version detection issues on Ubuntu 18.04
Browse files Browse the repository at this point in the history
ansible_python_interpreter is empty unless it is set explicitly therefore it is
not reliable way of knowing which version of python is used on remote host.
Using binary name to know the version is not reliable either.

Fixing by using ansible_python.version.major provided by ansible.
  • Loading branch information
giner committed Sep 9, 2020
1 parent d8fc0d3 commit f2f0c00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -815,4 +815,4 @@ postgresql_dnf_repository_gpgkey: "{{ postgresql_yum_repository_gpgkey }}"

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 }}"
postgresql_apt_dependencies: "{{ postgresql_apt_py3_dependencies if ansible_python.version.major == 3 else postgresql_apt_py2_dependencies }}"

0 comments on commit f2f0c00

Please sign in to comment.