Ansible Container Image¶
batteries-included Ansible runtime for local testing and GitLab pipelines.
Features¶
Debian and Alpine based tags so you can pick the footprint that matches your playbooks.
- Pre-installs
ansible,ansible-core,ansible-lint, andpasslib, plus SSH tooling, Git, curl, and tar. - Configures a non-root
ansibleuser, sensible cache directories, and a defaultlocalhostinventory so linting works out of the box. - GitLab CI Component at https://gitlab.com/explore/catalog/niclas-zone/ci/ansible.
Usage¶
Pull the images¶
podman pull registry.gitlab.com/niclas-zone/ctr/ansible:latest # Debian tag
podman pull registry.gitlab.com/niclas-zone/ctr/ansible:alpine # Alpine tag
Run a playbook in your project directory¶
podman run --rm -it \
-v $(pwd):/ansible \
-w /ansible \
registry.gitlab.com/niclas-zone/ctr/ansible:latest \
ansible-playbook site.yml
Molecule Testing Containers¶
Systemd-enabled Molecule base images live under molecule-images/ and are published to registry.gitlab.com/niclas-zone/ctr/ansible/molecule/*. Each tag ships as :latest and as :<ansible-version> to mirror the toolchain installed inside the container.
Debian¶
- Containerfiles:
molecule-images/Debian/Containerfile_Debian_12andContainerfile_Debian_13. - Tags:
registry.gitlab.com/niclas-zone/ctr/ansible/molecule/container-debian-12and.../container-debian-13. - Includes systemd, Python tooling, and a minimal inventory so you can target both Bookworm and Trixie in Molecule scenarios.
- Example Molecule platform snippet:
platforms:
- name: debian12
image: registry.gitlab.com/niclas-zone/ctr/ansible/molecule/container-debian-12:latest
command: /lib/systemd/systemd
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Ubuntu¶
- Containerfiles:
molecule-images/Ubuntu/Containerfile_Ubuntu2204(Jammy) andContainerfile_Ubuntu2404(Noble). - Tags:
registry.gitlab.com/niclas-zone/ctr/ansible/molecule/container-ubuntu-2204and.../container-ubuntu-2404. - Builds a dedicated virtual environment that carries the pinned Ansible version and sets
/lib/systemd/systemdas the default command for Molecule.
Fedora¶
- Containerfiles:
molecule-images/Fedora/Containerfile_Fedora_42,_43, and_44. - Tags:
registry.gitlab.com/niclas-zone/ctr/ansible/molecule/container-fedora-42,...-43, and...-44. - Systemd enabled
ansible-lint Container¶
The Debian tag doubles as an ansible-lint container and powers the GitLab CI Component ansible-lint. Because ansible-lint is preinstalled, you can lint any repository without installing Python locally:
podman run --rm -it \
-v $(pwd):/workspace \
-w /workspace \
registry.gitlab.com/niclas-zone/ctr/ansible:latest \
ansible-lint
The CI Component wraps the same image so local and pipeline lint checks stay in sync.
Author¶
Niclas Heinz
Contributing¶
Contributions are welcome! Please open an issue or submit a merge request if you have suggestions or improvements.
License¶
This project is licensed under the MIT License. See LICENSE for details.