Ubuntu 22.04 LTS (Jammy Jellyfish) Docker container for Ansible playbook and role testing.
latest: Latest stable version of Ansible.The latest tag is a lightweight image for basic validation of Ansible playbooks.
This image is built on Docker Hub automatically any time the upstream OS container is rebuilt, and any time a commit is made or merged to the master branch. But if you need to build the image on your own locally, do the following:
cd into this directory.docker build -t ubuntu2204-ansible .You can change version of ubuntu base image with
--build-arg IMAGE_TAG=22.04
# Get a shell in container
docker run -it --rm titom73/ubuntu bash
# Run ansible from container
$ docker run -it --rm titom73/ubuntu ansible --version
ansible [core 2.13.5]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0]
jinja version = 3.1.2
libyaml = True
docker pull titom73/ubuntu:latest.docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro titom73/ubuntu:latest--volume=`pwd`:/etc/ansible/roles/role_under_test:rodocker exec --tty [container_id] env TERM=xterm ansible --versiondocker exec --tty [container_id] env TERM=xterm ansible-playbook /path/to/ansible/playbook.yml --syntax-checkI use Docker to test my Ansible roles and playbooks on multiple OSes using CI tools like Jenkins and Travis. This container allows me to test roles and playbooks using Ansible running locally inside the container.
Important Note: I use this image for testing in an isolated environment—not for production—and the settings and configuration used may not be suitable for a secure and performant production environment. Use on production servers/in the wild at your own risk!
Initially created in 2022 by Jeff Geerling, author of Ansible for DevOps.
Content type
Image
Digest
sha256:a1c5bf5d1…
Size
302.6 MB
Last updated
over 1 year ago
docker pull titom73/ubuntu