Ansible Script to Deploy a Django Application
Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
group_vars
roles
.gitignore
LICENSE
README.md
Vagrantfile
requirements.txt
run_playbook.sh
site.yml

README.md

Deploy Django with Ansible

An opinionated Ansible deploy script for Ubuntu, Django, Postgres, Nginx and Gunicorn I use to deploy some of my django apps.

The configuration is a mix of solutions from different sources that work best for me.

Here are the articles I used to develop this deploy script:

Getting Started

  • Install Vagrant (https://www.vagrantup.com/downloads) and VirtualBox (https://www.virtualbox.org/)

  • Clone/download this repo

  • Install Ansible (Recommended: Via pip. To do that create a virtualev and run pip install -r requirements.txt within this repo's root dir)

  • Add an inventory file in the repo's root dir called hosts. To test with vagrant paste the following content into the file:

    [vagrant] default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222

  • Add a deploy ssh key from your repo to let the app pull your code. Add a file called deploy_key to the directory /roles/app/files/

  • tweak the /group_vars/all.yml file to comply with your app's setup

  • Acivate your virtualenv (run source venv/bin/activate)

  • From within this repo's root dir run vagrant up

Celery (optional)

I you want to use celery set install_celery: yes in group_vars/all.yml

TODO

  • Add more documentation

License

MIT licensed.