Automating deployment using Ansible
Ansible is a configuration management tool. It allows us to automate the deployment of our applications in a repeatable and manageable manner, without having to consider how our application is deployed each time.
Ansible works both locally and over SSH. One of the clever things you can do with Ansible is to get Ansible to configure itself. Based on your own configuration, it can then be told to deploy the other machines that it needs.
We, however, are just going to concentrate on building our own local Flask instance using Apache, WSGI, and Flask.
The first thing to do is install Ansible on the machine that we are going to deploy our Flask app on to. Since Ansible is written in Python, we can achieve this quite simply by making use of pip
:
sudo pip install ansible
We now have a configuration manager and, since a configuration manager is designed to set up servers, let's build up a playbook that Ansible can use to build the entire machine.
In a new project...