Sign inSign up

titom73/ubuntu

By titom73

•Updated over 1 year ago

Image
0

1.8K

titom73/ubuntu repository overview

⁠Ubuntu multiarch Test Image

Ubuntu 22.04 LTS (Jammy Jellyfish) Docker container for Ansible playbook and role testing.

⁠Tags

  • latest: Latest stable version of Ansible.

The latest tag is a lightweight image for basic validation of Ansible playbooks.

⁠How to Build

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:

  1. Install Docker⁠.
  2. cd into this directory.
  3. Run docker build -t ubuntu2204-ansible .

You can change version of ubuntu base image with --build-arg IMAGE_TAG=22.04

⁠How to use it

# 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

⁠How to Use to test ansible roles & collections

  1. Install Docker⁠.
  2. Pull this image from Docker Hub: docker pull titom73/ubuntu:latest.
  3. Run a container from the image:
    • docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro titom73/ubuntu:latest
    • --volume=`pwd`:/etc/ansible/roles/role_under_test:ro
  4. Use Ansible inside the container:
    • docker exec --tty [container_id] env TERM=xterm ansible --version
    • docker exec --tty [container_id] env TERM=xterm ansible-playbook /path/to/ansible/playbook.yml --syntax-check

⁠Notes

I 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!

⁠Author

Initially created in 2022 by Jeff Geerling⁠, author of Ansible for DevOps⁠.

Tag summary

Content type

Image

Digest

sha256:a1c5bf5d1…

Size

302.6 MB

Last updated

over 1 year ago

docker pull titom73/ubuntu