Fedora Docker containers for Ansible playbook and role testing.
Based on the work created by Jeff Geerling. I'm just using the base dockerFile that Jeff created and applying to the new versions of fedora including the testing ones. The ideia and the main work was made by him, so if you want, support him.
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 main
branch. But if you need to build the image on your own locally, do the following:
- Install Docker.
cd
into this directory.- Run
docker build -t fedora<version>-ansible <dockerFile>
- Install Docker.
- Pull this image from Docker Hub:
docker pull rubemlrm/fedora36-ansible:latest
(or use the image you built earlier, e.g.fedora36-ansible:latest
). - Run a container from the image:
docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro rubemlrm/fedora36-ansible:latest
(to test my Ansible roles, I add in a volume mounted from the current working directory with--volume=`pwd`:/etc/ansible/roles/role_under_test:ro
). - Use Ansible inside the container:
a.
docker exec --tty [container_id] env TERM=xterm ansible --version
b.docker exec --tty [container_id] env TERM=xterm ansible-playbook /path/to/ansible/playbook.yml --syntax-check