]> git.phdru.name Git - ansible.git/blob - playbooks/roles/python-packages/tasks/main.yml
Feat(roles/python-packages): Install `python-is-python2`
[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', 'python3-pip',
10            'python-setuptools', 'python3-setuptools',
11            'python-gdbm', 'python-openssl', 'python3-openssl',
12            'python-is-python2',
13           ]
14     state: latest
15     update_cache: yes
16   register: python
17   when: ansible_facts.os_family == 'Debian'
18
19 - name: Install Python and packages (RedHat)
20   become: true
21   dnf:
22     name: ['python2', 'python3', 'python2-pip', 'python3-pip',
23            'python2-setuptools', 'python3-setuptools',
24            'python2-pyOpenSSL', 'python3-pyOpenSSL',
25           ]
26     state: latest
27     update_cache: yes
28   register: python
29   when: ansible_facts.os_family == 'RedHat'
30
31 - name: Upgrade Python packages
32   become: true
33   shell: 'umask 022; exec {{ item }} -m pip install --compile --upgrade
34       "pip<19.1" setuptools tox virtualenv virtualenvwrapper
35       flake8 sphinx twine'
36   when: python.changed
37   loop: ['python3', 'python2']
38
39 - name: Install wheel for Python2
40   become: true
41   shell: 'umask 022; exec python2 -m pip install --compile --upgrade
42       "wheel==0.31.1"'
43   when: python.changed
44
45 - name: Install wheel and auditwheel for Python3
46   become: true
47   shell: 'umask 022; exec python3 -m pip install --compile --upgrade
48       "wheel==0.34.1" "auditwheel==3.1.0"'
49   when: python.changed