Ansible vs Docker

Ansible vs Docker in the delivery pipeline.
I believe there is place for both Ansible and Docker and we have something to show for it! In my current team one of our goals are: all our infrastructure as code in git. There is many ways of doing this but we are currently using Ansible And Docker. There is not many resources on google telling you how Ansible and Docker can benefit each other. But Ansible’s own site actually have three key points about this: These key points are: Flexibility, audibility, and ubiquity.


Ubiquity is what makes a combination of Ansible and Docker viable for us. Even though containers are awesome they cannot be run in total isolation. What I mean by this is that before we can run docker containers on our machine we need to install docker itself. There can be requirements about how the network of the machine should be setup. Sometimes we need to configure security aspects on the machine e.g. firewalls.
We are running a setup without a docker hub instead containers are distributed to the machine from a central tool: Ansible.
Ansible vs Docker
An easy analogy is the one the image is showing: Ansible prepares and moves containers, and the containers contain the application.

Example workflow

Our environment is a mix of windows and CENTOS boxes. We are currently not running docker on the windows boxes.
But by having Ansible we can actually configure both windows and linux system from one central place.
An example workflow from our setup:
Linux: Provision machine for docker -> move docker container containing web application to the machine -> run container.
Windows: Provision machine -> configure it for a web application -> deploy web application.

By using Ansible we can have a central place for both provisioning and configuration all of our machines. We are currently using powershell for windows and python for linux, however Ansible is equipped with a fairly large set of core modules which can fulfill most requirements. We have found Ansible easy to implement into our tool chain and all in all easy to work with. You can really feel that this is a tool by developers for developers doing operations.
There is a point to be made about kubernetes, and the like, where you have a platform for running your containers on a set of kubernetes hosts. But you would still need to configure kubernetes and what better tool to use than Ansible!
To summarize if you have a goal like ours, all infrastructure as code, Ansible and Docker is a great tool combination for making it a reality.