Sign inSign up

bsmeding/ansible_cicd_rockylinux8

By bsmeding

โ€ขUpdated 5 months ago

Ansible CI/CD container for ansible_cicd_rockylinux8

Image
0

4.0K

bsmeding/ansible_cicd_rockylinux8 repository overview

โ ๐Ÿณ Ansible CI/CD Docker Images

This repository provides prebuilt Docker images for Ansible-based CI/CD pipelines, built on multiple Linux distributions with Python and commonly used Ansible dependencies.

โ ๐Ÿงฉ Supported Base Images

Each image is built for a specific OS to match production environments or CI runner needs:

  • ubuntu2404 โ†’ Ubuntu 24.04
  • ubuntu2604 โ†’ Ubuntu 26.04
  • debian12 โ†’ Debian Bookworm
  • debian13 โ†’ Debian Trixie
  • rockylinux8 โ†’ Rocky Linux 8
  • rockylinux9 โ†’ Rocky Linux 9
  • alpine3.22 โ†’ Alpine 3.22
  • alpine3.23 โ†’ Alpine 3.23

Only the latest two versions per distro family are actively built and maintained. Older Docker Hub images remain available but are no longer updated.

Default tags point to the newest supported version for each distro family:

  • ubuntu โ†’ Ubuntu 26.04
  • debian โ†’ Debian Trixie
  • rockylinux โ†’ Rocky Linux 9
  • alpine3 โ†’ Alpine 3.23

Each image is tagged as:

bsmeding/ansible_cicd_<tag>:latest

โ ๐Ÿ“ฆ Included Software

Each image includes:

  • โœ… Ansible (version dynamically chosen per OS compatibility)
  • โœ… Python 3 with pip, setuptools, wheel
  • โœ… Common Python Ansible modules:
    • pynautobot, pynetbox
    • yamllint, cryptography, jmespath, netaddr, pywinrm
  • โœ… Systemd support for Molecule testing (Debian/Ubuntu-based only)

Alpine images are optimized for minimal footprint, while Debian/Rocky images offer compatibility with more complex Ansible roles and Python modules.


โ ๐Ÿ›  Use Cases

These images are great for:

  • ๐Ÿ” CI/CD pipelines (GitHub Actions, GitLab CI, etc.)
  • ๐Ÿงช Molecule testing of Ansible roles
  • ๐Ÿš€ Quick local Ansible testing
  • ๐Ÿงฐ Bootstrapping automation tooling in containerized workflows

โ ๐Ÿ“ฆ Usage in GitHub Actions

jobs:
  test:
    runs-on: ubuntu-latest
    container:
      image: bsmeding/ansible_cicd_ubuntu2404:latest
    steps:
      - uses: actions/checkout@v4
      - run: ansible-playbook playbook.yml

โ ๐Ÿงช Molecule Testing

These images are optimized for Molecule testing of Ansible roles. The images include systemd support and are pre-configured with Ansible and common dependencies.

โ Basic Molecule Configuration

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:-ubuntu2404}: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: "../../../"
โ Key Configuration Options
  • command: /lib/systemd/systemd - Overrides the default bash CMD to enable systemd (required for service management)
  • privileged: true - Required for systemd to function properly
  • cgroupns_mode: host - Allows systemd to manage cgroups
  • volumes: /sys/fs/cgroup:/sys/fs/cgroup:rw - Mounts cgroup filesystem for systemd
โ Testing Multiple Distributions

Use environment variables to test different distributions:

# Test on Ubuntu 24.04
MOLECULE_DISTRO=ubuntu2404 molecule test

# Test on Debian 12
MOLECULE_DISTRO=debian12 molecule test

# Test on Rocky Linux 9
MOLECULE_DISTRO=rockylinux9 molecule test
โ Advanced Configuration (Docker-in-Docker)

For roles that need Docker (e.g., deploying containers), add Docker socket access:

platforms:
  - name: instance
    image: bsmeding/ansible_cicd_${MOLECULE_DISTRO:-ubuntu2404}: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
โ Ansible Interpreter Configuration

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.


โ ๐Ÿ›ณ Available on Docker Hub

All images are pushed to Docker Hubโ :

๐Ÿ“ฆ bsmeding/ansible_cicd_ubuntu2404โ 
๐Ÿ“ฆ bsmeding/ansible_cicd_debian13โ 
... and more!


โ ๐Ÿ™Œ Contributions

Feel free to open issues or PRs if:

  • A new base image version is available
  • You want additional packages
  • You find bugs or build failures

โ ๐Ÿ“œ License

MIT


โ ๐Ÿ‘ค Maintainer

bsmedingโ  โ€” Built for reproducible Ansible pipelines and fast Molecule testing.

Tag summary

Content type

Image

Digest

sha256:0e7e61830โ€ฆ

Size

438.6 MB

Last updated

5 months ago

docker pull bsmeding/ansible_cicd_rockylinux8