Skip to content

Commit

Permalink
feat(venvs): split python 2.7 venv creation
Browse files Browse the repository at this point in the history
Install `virtualenv` with `pip` to ensure it works.
  • Loading branch information
gforcada committed May 12, 2024
1 parent 2936bb3 commit a322440
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
41 changes: 41 additions & 0 deletions tasks/venv27.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---

- name: "Virtualenv | Check if it is already installed | {{ py_data.version }}"
become: true
ansible.builtin.stat:
path: "{{ py_data.install }}/bin/virtualenv"
register: already_installed
ignore_errors: true

- name: "Virtualenv | Download | {{ py_data.version }}"
ansible.builtin.get_url:
url: "{{ venv_data.url }}"
dest: "{{ venv_data.wheel_file }}"
checksum: "md5:{{ venv_data.md5 }}"
mode: "0440"
when: not already_installed.stat.exists

- name: "Virtualenv | Download | pip"
ansible.builtin.get_url:
url: "https://bootstrap.pypa.io/pip/2.7/get-pip.py"
dest: "/tmp/get-pip.py"
checksum: "md5:60e8267eb1b7bc71dc4843eb7bd294d3"
mode: "0440"
when: not already_installed.stat.exists

- name: "Virtualenv | Install | pip"
ansible.builtin.command: "{{ item }}"
args:
creates: "{{ py_data.install }}/bin/pip"
with_items:
- "{{ py_data.install }}/bin/python /tmp/get-pip.py"
when: not already_installed.stat.exists

- name: " Virtualenv | Install | {{ py_data.version }}"
become: true
ansible.builtin.command: "{{ item }}"
args:
creates: "{{ py_data.install }}/bin/virtualenv"
with_items:
- "{{ py_data.install }}/bin/pip install {{ venv_data.wheel_file }}"
when: not already_installed.stat.exists
2 changes: 1 addition & 1 deletion tasks/venvs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

- name: Install Virtualenv for Python 2.7
ansible.builtin.include_tasks:
file: venv.yml
file: venv27.yml
vars:
py_data: "{{ py27 }}"
venv_data: "{{ venv27 }}"
Expand Down

0 comments on commit a322440

Please sign in to comment.