47 lines
1.8 KiB
YAML

---
# get latest pip (had problems with version from apt-get, specifically
# "pip install pyopenssl" did not install the dependency "cryptography")
# http://stackoverflow.com/questions/34587473/what-is-get-pip-py-checksum-where-can-i-get-it-for-sure
- name: install setuptools for python 2 and 3
become: true
apt: name={{item}} state=present
with_items:
- python-setuptools
- python3-setuptools
- name: download pip-9.0.1.tar.gz
get_url:
url: https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
dest: /tmp
checksum: sha1:57ff41e99cb01b6a1c2b0999161589b726f0ec8b
- name: extract pip-9.0.1.tar.gz
unarchive: src=/tmp/pip-9.0.1.tar.gz dest=/tmp copy=no
# this clause is a workaround for travis-ci, which only wants to install in /usr
# see https://travis-ci.org/internetarchive/brozzler/builds/174338601
# but it complains that /usr/lib/python3.4/site-packages doesn't exist
# see https://travis-ci.org/internetarchive/brozzler/builds/174094831
- file: path={{item}} state=directory
with_items:
- /usr/lib/python3.4/site-packages
- /usr/lib/python3.4/dist-packages
become: true
- name: run "python3 setup.py install" in /tmp/pip-9.0.1
command: python3 setup.py install
chdir=/tmp/pip-9.0.1
creates=/usr/local/lib/python3.4/dist-packages/pip-9.0.1-py3.4.egg/pip/__init__.py
become: true
- name: run "pip install virtualenv"
command: pip install virtualenv
creates=/usr/local/lib/python3.4/dist-packages/virtualenv.py
become: true
- command: id {{user}}
register: id_user
ignore_errors: true
changed_when: false
- name: ensure service user {{user}} exists
user: name={{user}} system=yes createhome=no home=/nonexistent
shell=/usr/sbin/nologin
become: true
when: id_user|failed