This Docker image aims to ensure that everybody is using the same Ansible environment for deploying to production.
The image is based on a selected Ubuntu distro and contains minimal Ansible (Core) installation.
Maintaining multiple versions of Ansible can be a hassle. Therefore we started to use a common docker image for all Devops activity. This makes it easy to check new versions and upgrade the Ansible roles and playbooks.
The default entry point is bash.
Old Python2 based Ansible versions:
docker run -it --rm --mount src="$(pwd)",target=/ansible,type=bind hnhs/ansible:py2-bionic-2.5.4 ansible-playbook ...
Latest Python3 based Ansible versions:
docker run -it --rm --mount src="$(pwd)",target=/ansible,type=bind hnhs/ansible:focal-2.17.4
We recommend to mount a volume for the ansible galaxy roles and collections.
All build arguments are introduced at the top of the Dockerfiles.
docker build --build-arg ANSIBLE_VERSION=2.5.4 --build-arg ANSIBLE_GIT_BRANCH=v2.5.4 -t ansible:py2-2.5.4 python2
docker build --build-arg ANSIBLE_VERSION=2.5.4 --build-arg ANSIBLE_GIT_BRANCH=v2.5.4 -t ansible:2.5.4 python3
docker build --build-arg ANSIBLE_VERSION=2.11.4 --build-arg ANSIBLE_GIT_BRANCH=v2.11.4 -t ansible:2.11.4 python3
docker build --build-arg DISTRO=noble --build-arg ANSIBLE_VERSION=2.17.4 --build-arg ANSIBLE_GIT_BRANCH=v2.17.4 -t ansible:2.17.4 python3