Rocky Linux 8.7 container for Ansible playbook and role testing.
latest
: Latest stable version of Ansible (lightweight image for basic validation of Ansible playbooks).
This image is built on GitHub automatically any time a commit is made or merged to the main
branch and tagged. But if you need to build the image on your own locally, do the following:
-
- In the commands below,
podman
may be interchanged withdocker
depending on your choice.
- In the commands below,
-
cd
into the directory containing this repository. -
Build the image:
podman build --file Containerfile --tag rockylinux8.7-ansible .
-
- In the commands below,
podman
may be interchanged withdocker
depending on your choice.
- In the commands below,
-
Pull this image from GitHub (or use the image you built above
rockylinux8.7-ansible:latest
):podman pull ghcr.io/chpc-uofu/container-rockylinux8.7-ansible:latest
-
Run a container from the image:
podman run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro ghcr.io/chpc-uofu/container-rockylinux8.7-ansible:latest
To test Ansible roles it is helpful to add in a volume from the current working directory with the following option:
--volume=${PWD}:/etc/ansible/roles/role_under_test:ro
-
Use Ansible inside the container. Here are a few examples.
Check Ansible's version:
podman exec --tty [container_id] env TERM=xterm ansible --version
Check the syntax of an Ansible playbook:
podman exec --tty [container_id] env TERM=xterm ansible-playbook /path/to/ansible/playbook.yml --syntax-check
- Submit a pull request against
main
. - Once the automated status checks pass, complete the pull request by squash-merging with
main
. - Apply a semantic version tag to the resulting commit (e.g.
v1.0.1
). - At this point the automatic image build on GitHub will trigger, tagging the new image with the semantic version and
latest
.
Derived from geerlingguy/docker-rockylinux8-ansible.