As we do not have any pypi server here, I usually deliver the following deploy.yml with every python application I write:
- hosts: {{ my_host }}
vars:
version: "0.1"
venv_location: /path/to/venv
tasks:
- name: assure virtualenv
sudo: yes
pip:
name=virtualenv
- name: create sdist
local_action:
command python setup.py sdist
- name: copy sdist to target
copy:
src=/dist/myapp-{{ version }}.tar.gz
dest=/tmp/
- name: uninstall myapp
sudo: yes
pip:
virtualenv={{ venv_location }}
name=myapp
state=absent
- name: install myapp
sudo: yes
pip:
virtualenv={{ venv_location }}
name=/tmp/myapp
state=present
There are two problems there:
1. There seems to be no way to always install the latest version, so as it is now, I have to update the version in at least two places: playbook and my setup.py
2. I have to uninstall and to install the app (two tasks)
Is there any less fragile way to deliver applications with a deployment possibility?