An Ansible Playbook for quickly getting a Django Web App up and running on CentOS.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


An Ansible Playbook for quickly getting any Django web app up and running on CentOS.

This playbook installs and configures the following applications:

* Python (latest version from source)
* Nginx
* Gunicorn
* PostgreSQL
* Memcached (latest version from source)
* RabbitMQ
* Virtualenv
* Supervisor
* Celery
* Flower
* Django

For demonstration purposes only, this playbook deploys a sample Django Blog app but the main purpose of this project is that you are able to deploy any Django web app.

Tested on CentOS 6.5 x64 with Cloud Providers: Digital Ocean, Flutue


Ansible (v1.6.10)


sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
brew update
brew install ansible

SSHPass (v.1.05)


sudo apt-get install sshpass
cd ~/Downloads
curl -O -L
tar xvzf sshpass-1.05.tar.gz
cd sshpass-1.05

sudo make install

Getting Started

As you may have seen, this project comes with a sample Vagrantfile. This means you can use Vagrant and VirtualBox to quickly test this playbook on your local machine without having to sign up for a cloud hosting service.

To get started, first you need to checkout this repository on your local machine:

git clone

Also make sure you have both Vagrant (v1.6.3) and VirtualBox (v4.3.18) or latest versions installed and run the following command:

cd ansible-centos-django-stack && vagrant up

Wait a few minutes and go to and you will see a simple blog app up and running!

You should also be able to access the following URLs:

Really impressive, uh?

Playing on a real cloud server

If you already have a Cloud Hosting account and want to test this playbook there, go ahead and just edit the hosts/production file with your hosts information and edit the group_vars/producrion.

Then, all you have to do is run the following command:

ansible-playbook -i hosts/{{ environment }} site.yml --ask-pass

PS: Some Cloud providers' VPSs come with iptables firewall enabled blocking all the traffic. In this case you will have to set up some rules in order to test this playbook. If you don't mind opening all ports, you can flush the firewall rules by running the following command:

iptables -F

Playing with your own web app

If you want to test your own web app, just edit the groups_vars/all file with your app settings.

Pay attention to the "repo_deploy_key" setting. The one on group_vars/all is for demonstration purposes only. When deploying your app, you will have to create your own deployment key on Github, Bitbucket, Stash etc.

More info about deployment keys below: