forked from ISTI-ansible-roles/ansible-roles
Make the python3-env role compatible with Ubuntu 18.04.
This commit is contained in:
parent
af6fac7a36
commit
36149bc631
|
@ -1,7 +1,9 @@
|
||||||
---
|
---
|
||||||
py3_env_install: False
|
py3_env_install: False
|
||||||
py3_ppa: 'ppa:deadsnakes/ppa'
|
py3_ppa: 'ppa:deadsnakes/ppa'
|
||||||
py3_env_version: 3.6
|
py3_env_major_version: 3
|
||||||
|
py3_env_minor_version: 6
|
||||||
|
py3_env_version: '{{ py3_env_major_version }}.{{py3_env_minor_version }}'
|
||||||
py3_env_pkgs_state: present
|
py3_env_pkgs_state: present
|
||||||
py3_pip_pkgs_state: present
|
py3_pip_pkgs_state: present
|
||||||
py3_env_site: False
|
py3_env_site: False
|
||||||
|
|
|
@ -12,15 +12,31 @@
|
||||||
- name: Install the python3 deb packages
|
- name: Install the python3 deb packages
|
||||||
apt: name={{ py3_env_dpkg }} state={{ py3_env_pkgs_state }} update_cache=yes cache_valid_time=600
|
apt: name={{ py3_env_dpkg }} state={{ py3_env_pkgs_state }} update_cache=yes cache_valid_time=600
|
||||||
|
|
||||||
- name: Install the correct pip3 version
|
- name: Install python3-pip deb packages
|
||||||
|
apt: name=python3-pip state={{ py3_env_pkgs_state }} update_cache=yes cache_valid_time=600
|
||||||
|
when: ansible_distribution_version is version_compare('18.04', '>=')
|
||||||
|
|
||||||
|
- name: Install the correct pip3 version on Ubuntu < 18.04
|
||||||
shell: python{{ py3_env_version }} -m ensurepip && pip{{ py3_env_version }} install --upgrade pip setuptools wheel
|
shell: python{{ py3_env_version }} -m ensurepip && pip{{ py3_env_version }} install --upgrade pip setuptools wheel
|
||||||
|
when: ansible_distribution_version is version_compare('18.04', '<')
|
||||||
|
|
||||||
- name: Install a list of pip packages
|
- name: Install a list of pip packages
|
||||||
pip: executable=pip{{ py3_env_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }}
|
pip: executable=pip{{ py3_env_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }}
|
||||||
|
when: ansible_distribution_version is version_compare('18.04', '<')
|
||||||
|
|
||||||
|
- name: Install a list of pip packages
|
||||||
|
pip: executable=pip{{ py3_env_major_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }}
|
||||||
|
when: ansible_distribution_version is version_compare('18.04', '>=')
|
||||||
|
|
||||||
- name: Install a list of versioned pip packages
|
- name: Install a list of versioned pip packages
|
||||||
pip: executable=pip{{ py3_env_version }} name={{ item.pkg }} version={{ item.version }}
|
pip: executable=pip{{ py3_env_version }} name={{ item.pkg }} version={{ item.version }}
|
||||||
with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}'
|
with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}'
|
||||||
|
when: ansible_distribution_version is version_compare('18.04', '<')
|
||||||
|
|
||||||
|
- name: Install a list of versioned pip packages
|
||||||
|
pip: executable=pip{{ py3_env_major_version }} name={{ item.pkg }} version={{ item.version }}
|
||||||
|
with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}'
|
||||||
|
when: ansible_distribution_version is version_compare('18.04', '>=')
|
||||||
|
|
||||||
when: py3_env_install
|
when: py3_env_install
|
||||||
tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ]
|
tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ]
|
||||||
|
|
Loading…
Reference in New Issue