From a322440adcc9104f93844f88c319a5edc8a83f88 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 12 May 2024 10:19:11 +0200 Subject: [PATCH] feat(venvs): split python 2.7 venv creation Install `virtualenv` with `pip` to ensure it works. --- tasks/venv27.yml | 41 +++++++++++++++++++++++++++++++++++++++++ tasks/venvs.yml | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tasks/venv27.yml diff --git a/tasks/venv27.yml b/tasks/venv27.yml new file mode 100644 index 0000000..d13408b --- /dev/null +++ b/tasks/venv27.yml @@ -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 diff --git a/tasks/venvs.yml b/tasks/venvs.yml index c28511b..f3cc48b 100644 --- a/tasks/venvs.yml +++ b/tasks/venvs.yml @@ -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 }}"