python project deployment & version

41 views
Skip to first unread message

ProfHase

unread,
Sep 10, 2015, 6:01:18 AM9/10/15
to Ansible Project
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?

Brian Coca

unread,
Sep 10, 2015, 10:54:32 AM9/10/15
to Ansible Project
does state=latest not work?


--
Brian Coca

ProfHase

unread,
Sep 23, 2015, 5:49:39 AM9/23/15
to Ansible Project
It would usually, but for the copy task as well as for the `install myapp` task i need to pass the filename to the pip module. setuptools always generates the filename as {{ package }}-{{ version }}.tar.gz

(Sorry for the late answer, had some troubles with google)
Reply all
Reply to author
Forward
0 new messages