Ansible CI/CD container for ansible_cicd_debian11
3.8K
This repository provides prebuilt Docker images for Ansible-based CI/CD pipelines, built on multiple Linux distributions with Python and commonly used Ansible dependencies.
Each image is built for a specific OS to match production environments or CI runner needs:
ubuntu2004 โ Ubuntu 20.04ubuntu2204 โ Ubuntu 22.04debian11 โ Debian Bullseyedebian12 โ Debian Bookwormrockylinux8 โ Rocky Linux 8rockylinux9 โ Rocky Linux 9alpine3.20 โ Alpine 3.20alpine3.21 โ Alpine 3.21Each image is tagged as:
bsmeding/ansible_cicd_<tag>:latest
Each image includes:
pip, setuptools, wheelpynautobot, pynetboxyamllint, cryptography, jmespath, netaddr, pywinrmAlpine images are optimized for minimal footprint, while Debian/Rocky images offer compatibility with more complex Ansible roles and Python modules.
These images are great for:
jobs:
test:
runs-on: ubuntu-latest
container:
image: bsmeding/ansible_cicd_ubuntu2204:latest
steps:
- uses: actions/checkout@v4
- run: ansible-playbook playbook.yml
These images are optimized for Molecule testing of Ansible roles. The images include systemd support and are pre-configured with Ansible and common dependencies.
Create a molecule/default/molecule.yml file in your Ansible role:
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: "bsmeding/ansible_cicd_${MOLECULE_DISTRO:-ubuntu2204}:latest"
command: ${MOLECULE_DOCKER_COMMAND:-"/lib/systemd/systemd"}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
cgroupns_mode: host
tmpfs:
- /run
- /run/lock
environment:
container: docker
privileged: true
pre_build_image: true
provisioner:
name: ansible
config_options:
defaults:
gather_facts: true
remote_tmp: /var/tmp/.ansible
roles_path: "../../../"
command: /lib/systemd/systemd - Overrides the default bash CMD to enable systemd (required for service management)privileged: true - Required for systemd to function properlycgroupns_mode: host - Allows systemd to manage cgroupsvolumes: /sys/fs/cgroup:/sys/fs/cgroup:rw - Mounts cgroup filesystem for systemdUse environment variables to test different distributions:
# Test on Ubuntu 22.04
MOLECULE_DISTRO=ubuntu2204 molecule test
# Test on Debian 12
MOLECULE_DISTRO=debian12 molecule test
# Test on Rocky Linux 9
MOLECULE_DISTRO=rockylinux9 molecule test
For roles that need Docker (e.g., deploying containers), add Docker socket access:
platforms:
- name: instance
image: bsmeding/ansible_cicd_${MOLECULE_DISTRO:-ubuntu2204}:latest
command: /lib/systemd/systemd
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/run/docker.sock:/var/run/docker.sock
cgroupns_mode: host
privileged: true
pre_build_image: true
environment:
DOCKER_HOST: unix:///var/run/docker.sock
capabilities:
- SYS_ADMIN
- NET_ADMIN
- SYS_CHROOT
# ... additional capabilities as needed
The images are pre-configured with the correct Python interpreter path (/opt/venv/bin/python). When you install additional packages via pip install in your CI/CD pipeline, they will be automatically available to Ansible since everything runs in the same virtual environment.
Note: Alpine images use /bin/sh as the default CMD and don't support systemd. Use Debian/Ubuntu/Rocky images for roles that require systemd.
All images are pushed to Docker Hubโ :
๐ฆ bsmeding/ansible_cicd_ubuntu2204โ
๐ฆ bsmeding/ansible_cicd_debian13โ
... and more!
Feel free to open issues or PRs if:
MIT
bsmedingโ โ Built for reproducible Ansible pipelines and fast Molecule testing.
Content type
Image
Digest
sha256:e4e147be2โฆ
Size
535.5 MB
Last updated
5 months ago
docker pull bsmeding/ansible_cicd_debian11