Add a role that fixes the Ubuntu Trusty python distribution.

This commit is contained in:
Andrea Dell'Amico 2018-07-25 12:23:10 +02:00
parent d2a7454b22
commit 83012be82a
3 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,22 @@
---
python_pkgs_state: present
python_trusty_workaround: True
python_get_pip_url: https://bootstrap.pypa.io/get-pip.py
python_basic_pkgs:
- python-pip
python_pip_dev_packages:
- libpython-dev
- libssl-dev
- libffi-dev
python_pip_fix_ssl_warnings:
- pyOpenSSL
- cryptography
- idna
- certifi
- ndg-httpsclient
- urllib3
- pyasn1

View File

@ -0,0 +1,7 @@
#!/bin/bash
GET_PIP=/usr/local/lib/get-pip.py
chmod 755 $GET_PIP
$GET_PIP

View File

@ -0,0 +1,33 @@
---
- block:
- name: Install the get-pip.py pip downloader
get_url: url={{ python_get_pip_url }} dest=/usr/local/lib/get-pip.py
- name: Install a script that fixes the broken trusty pip package
copy: src=pip-fixer.sh dest=/usr/local/bin/python-pip-fixer mode=0755 owner=root group=root
register: python_pip_fixer
- name: Fix the trusty pip installation
shell: /usr/local/bin/python-pip-fixer
when: python_pip_fixer is changed
- name: Install the python dev headers and other dev requirements
apt: pkg={{ item }} state={{ python_pkgs_state }} update_cache=yes cache_valid_time=1800
with_items: '{{ python_pip_dev_packages }}'
- name: Install a specific version of tornado to avoid breaking dependencies
pip: name=tornado version=4.1 state=present
- name: Install the latest six python package
pip: name=six state=present
- name: Install setuptools version 33.1.1
pip: name=setuptools version=33.1.1 state=present
- name: Fix the ssl warnings installing some ssl libraries
pip: name={{ item }} state={{ python_pkgs_state }}
with_items: '{{ python_pip_fix_ssl_warnings | default ([]) }}'
register: python_pip_env_workaround
when: is_trusty
tags: [ "python", 'py_env', 'ansible_setup' ]