Role to install python 3 > 3.4 on Ubuntu 14.04.

This commit is contained in:
Andrea Dell'Amico 2018-10-24 19:09:39 +02:00
parent 9905a5a8e7
commit c710ede34b
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,14 @@
---
py3_env_install: False
py3_ppa: 'ppa:deadsnakes/ppa'
py3_env_version: 3.6
py3_env_pkgs_state: present
py3_env_site: False
py3_env_basic_pkgs:
- python-pip
py3_env_dpkg:
- 'python{{ py3_env_version }}'
- 'python{{ py3_env_version }}-venv'
- 'python{{ py3_env_version }}-dev'

View File

@ -0,0 +1,23 @@
---
- block:
- name: Install the python 3 ppa repository
apt_repository: repo={{ py3_ppa }} update_cache=yes state=present
- name: Install the python3 deb packages
apt: name={{ py3_env_dpkg }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600
- name: Install the correct pip3 version
shell: python{{ py3_env_version }} -m ensurepip && pip{{ py3_env_version }} install --upgrade pip setuptools wheel
- name: Install a list of pip packages
pip: executable=pip{{ py3_env_version }} name={{ py3_env_pip_pkgs }} state=latest
- name: Install a list of versioned pip packages
pip: executable=pip{{ py3_env_version }} name={{ item.pkg }} version={{ item.version }}
with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}'
when:
- py3_env_install
- is_trusty
tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ]