docker & docker_compose: Use virtualenv & correct python version

This ensures failure when trying to install newer versions, that are not supported on python2.7 anymore, when python3 is also installed on the system.
This commit is contained in:
Saibotk 2022-06-18 11:46:33 +02:00
parent 0372930098
commit 06fa8b98ef
Signed by: saibotk
GPG key ID: 67585F0065E261D5
2 changed files with 3 additions and 1 deletions

View file

@ -48,7 +48,8 @@
pip:
name: "{{ docker_pip_package }}"
state: "{{ docker_pip_package_state }}"
extra_args: "--target {{ docker_python_package_path }}"
virtualenv: "{{ docker_python_package_path }}"
virtualenv_python: "python{{ ansible_python_version | regex_search('\\d+\\.\\d+') }}"
version: "{{ docker_pip_package_version }}"
become: true
changed_when: false

View file

@ -37,6 +37,7 @@
name: "{{ docker_compose_pip_package }}"
state: "{{ docker_compose_pip_package_state }}"
virtualenv: "{{ docker_compose_python_package_path }}"
virtualenv_python: "python{{ ansible_python_version | regex_search('\\d+\\.\\d+') }}"
version: "{{ docker_compose_pip_package_version | default(omit) }}"
become: true
changed_when: false