Dockerizing an Ansible Playbook, Part 1
This is a two-part article series. This is Part 1 of the series, where we will go over the concept of Dockerization. And then, Dockerize an Ansible playbook to run in a Docker container.
In Part 2, we will create a GitLab pipeline to register the Docker image of the Ansible playbook to a Docker registry and deploy it to Kubernetes.
With the continuously increasing complexity of the business problem domain, building a solution needs a whole lot of dependent libraries and tools with different versions while managing their interdependencies and cross-dependencies. The most challenging area is porting an application to a hosting environment where some of the dependent libraries and packages with specific versions are already installed as part of other applications hosted in the system. Â The developer now has to deal with conflicting versions while building and running their application without impacting any existing ones.Â
- ROI – Docker dramatically reduces infrastructure costs as it is lightweight and needs only fewer resources to run the same application. It allows multiple applications to run in their own container, sharing the same underlying OS layer
- Developer experienceÂ
- Faster deployment as the developer needs to bundle only the libraries and tools that its application needs in a declarative manner. There is no time spent in setting up an infra. Once done, it can be reused again and again.
- Easier debugging as a developer can reproduce the environment easily anywhere with the same exact set of dependencies. This makes promoting to a higher environment, such as UAT and PROD, easy and more reliable
- Better security as less access is needed to work with the code running inside a container.