Skip to content

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, and passlib, plus SSH tooling, Git, curl, and tar.
  • Configures a non-root ansible user, sensible cache directories, and a default localhost inventory so linting works out of the box.
  • GitLab CI Component at 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

Run ansible-lint

podman run --rm -it \
  -v $(pwd):/workspace \
  -w /workspace \
  registry.gitlab.com/niclas-zone/ctr/ansible:latest \
  ansible-lint

GitLab CI snippet

ansible-lint:
  image: registry.gitlab.com/niclas-zone/ctr/ansible:latest
  script:
    - ansible-lint

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

  • Tags: registry.gitlab.com/niclas-zone/ctr/ansible/molecule/container-debian-12 and .../container-debian-13.
  • Includes systemd, Python tooling, and a minimal inventory so you can target both Bookworm and Trixie in Molecule scenarios.
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

  • Tags: registry.gitlab.com/niclas-zone/ctr/ansible/molecule/container-ubuntu-2204 and .../container-ubuntu-2404.
  • Builds a dedicated virtual environment that carries the pinned Ansible version and sets /lib/systemd/systemd as the default command for Molecule.

Fedora

  • Tags: registry.gitlab.com/niclas-zone/ctr/ansible/molecule/container-fedora-42, ...-43, and ...-44.
  • Systemd enabled.

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.