]> git.phdru.name Git - ansible.git/blob - playbooks/roles/python-packages/tasks/main.yml
Fix(python-packages): Install `python-pip`
[ansible.git] / playbooks / roles / python-packages / tasks / main.yml
1 - name: Install Python and packages (Debian)
2   become: true
3   apt:
4     autoclean: yes
5     autoremove: yes
6     cache_valid_time: 3600
7     install_recommends: no
8     name: ['patchelf', # for auditwheel
9            'python', 'python2.7', 'python3', "{{ python_pip_pkg }}",
10            'python3-pip', 'python-setuptools', 'python3-setuptools',
11            'python-gdbm', 'python-openssl', 'python3-openssl',
12            'python-is-python2',
13           ]
14     state: latest
15     update_cache: yes
16   vars:
17     python_pip_pkg: "python-pip{% if ansible_facts.distribution_major_version in ['9', '10'] %}{% elif ansible_facts.distribution_major_version == '11' %}-whl{% endif %}"
18   register: python
19   when: ansible_facts.os_family == 'Debian'
20
21 - name: Install Python and packages (RedHat)
22   become: true
23   dnf:
24     name: ['python2', 'python3', 'python2-pip', 'python3-pip',
25            'python2-setuptools', 'python3-setuptools',
26            'python2-pyOpenSSL', 'python3-pyOpenSSL',
27           ]
28     state: latest
29     update_cache: yes
30   register: python
31   when: ansible_facts.os_family == 'RedHat'
32
33 - name: Upgrade Python packages
34   become: true
35   shell: 'umask 022; exec {{ item }} -m pip install --compile --upgrade
36       "pip<19.1" setuptools tox virtualenv virtualenvwrapper
37       flake8 sphinx twine'
38   when: python.changed
39   loop: ['python3', 'python2']
40
41 - name: Install wheel for Python2
42   become: true
43   shell: 'umask 022; exec python2 -m pip install --compile --upgrade
44       "wheel==0.31.1"'
45   when: python.changed
46
47 - name: Install wheel and auditwheel for Python3
48   become: true
49   shell: 'umask 022; exec python3 -m pip install --compile --upgrade
50       "wheel==0.34.1" "auditwheel==3.1.0"'
51   when: python.changed