2016-10-12 19:33:12 -07:00
|
|
|
# Current pip unconditionally uses md5.
|
|
|
|
# We can re-enable if pip switches to a different hash or allows us to not check md5.
|
2016-09-20 17:56:07 -07:00
|
|
|
|
2021-01-07 18:21:28 -08:00
|
|
|
- name: Python 2
|
|
|
|
when: ansible_python.version.major == 2
|
|
|
|
block:
|
|
|
|
- name: find virtualenv command
|
|
|
|
command: "which virtualenv virtualenv-{{ ansible_python.version.major }}.{{ ansible_python.version.minor }}"
|
|
|
|
register: command
|
|
|
|
ignore_errors: true
|
2020-09-25 14:30:47 -05:00
|
|
|
|
2021-01-07 18:21:28 -08:00
|
|
|
- name: is virtualenv available to python -m
|
|
|
|
command: '{{ ansible_python_interpreter }} -m virtualenv'
|
|
|
|
register: python_m
|
|
|
|
when: not command.stdout_lines
|
|
|
|
failed_when: python_m.rc != 2
|
2019-03-27 13:56:28 -07:00
|
|
|
|
2021-01-07 18:21:28 -08:00
|
|
|
- name: remember selected virtualenv command
|
|
|
|
set_fact:
|
|
|
|
virtualenv: "{{ command.stdout_lines[0] if command is successful else ansible_python_interpreter ~ ' -m virtualenv' }}"
|
|
|
|
|
|
|
|
- name: Python 3+
|
|
|
|
when: ansible_python.version.major > 2
|
|
|
|
block:
|
|
|
|
- name: remember selected virtualenv command
|
|
|
|
set_fact:
|
|
|
|
virtualenv: "{{ ansible_python_interpreter ~ ' -m venv' }}"
|
2019-03-27 13:56:28 -07:00
|
|
|
|
2019-03-28 15:09:17 -07:00
|
|
|
- block:
|
|
|
|
- name: install git, needed for repo installs
|
|
|
|
package:
|
|
|
|
name: git
|
|
|
|
state: present
|
2020-08-07 14:28:10 -05:00
|
|
|
when: ansible_distribution not in ["MacOSX", "Alpine"]
|
2019-03-28 15:09:17 -07:00
|
|
|
register: git_install
|
|
|
|
|
2020-09-25 14:30:47 -05:00
|
|
|
- name: ensure wheel is installed
|
|
|
|
pip:
|
|
|
|
name: wheel
|
|
|
|
|
2019-03-28 15:09:17 -07:00
|
|
|
- include_tasks: pip.yml
|
|
|
|
always:
|
2020-02-10 15:25:38 -08:00
|
|
|
- name: platform specific cleanup
|
|
|
|
include_tasks: "{{ cleanup_filename }}"
|
|
|
|
with_first_found:
|
|
|
|
- "{{ ansible_distribution | lower }}_cleanup.yml"
|
|
|
|
- "default_cleanup.yml"
|
|
|
|
loop_control:
|
|
|
|
loop_var: cleanup_filename
|
2016-10-12 19:33:12 -07:00
|
|
|
when: ansible_fips|bool != True
|
2019-03-27 13:56:28 -07:00
|
|
|
module_defaults:
|
|
|
|
pip:
|
|
|
|
virtualenv_command: "{{ virtualenv }}"
|