Automated patching approaches using Ansible
Patching and updating is a task that everyone who has to manage production systems has to deal with. There are two approaches that we will look are as follows:
- Rolling updates
- BlueGreen deployments
Rolling updates
Imagine that we have five web servers behind a load balancer. What we would like to do is a zero downtime upgrade of our web application. Using certain keywords available in Ansible, we can make this happen.
In our example, we want to achieve the following:
- Tell the load balancer that web server node is down
- Bring down the web server on that node
- Copy the updated application files to that node
- Bring up the web server on that node
The first keyword for us to look at is serial
. Let's see this example from Ansible documentation:
- name: test play hosts: webservers serial: 1
The example is from http://docs.ansible.com/ansible/latest/playbooks_delegation.html#rolling-update-batch-size.
This ensures that the execution of the playbook is done serially...