Code Monkey home page Code Monkey logo

ansible-container-images's Introduction

Ansible Container Images

GitHub Workflow Status

Summary

Repository name in Docker Hub: macunha1/ansible

This repository contains Jinja2 templates to specify Dockerfiles for multiple Linux distros, these templates are rendered and then dynamically build by GitHub Actions. Therefore, it is the composition of: templates + a script to render + the CI pipeline to build and push the images.

Base OS

By default the following Linux distros are implemented. However, any future (version) release of any one of the supported distro can be easily added in the config to render a new Dockerfile.

  • Debian: 10 (buster), 11 (bullseye);
  • Ubuntu: 20.04, 22.04, 22.10;
  • Alpine 3.10, 3.15, 3.16;

Pending: OpenSUSE and Fedora.

Usage

Ansible will be installed with the version specified on config. All Docker images had Ansible installed through pip.

To make sure the right version of Ansible is installed on container during execution of tests, run a pip install ansible==$DESIRED_VERSION.

Quick

Here comes a simplest working example:

FROM macunha1/ansible:alpine-3.11.5

RUN pip install ansible==2.3.4

ENTRYPOINT ["ansible-playbook"]
CMD ["-i", "inventory/awesome", "playbook.yml"]

Then,

docker build -f /path/to/Dockerfile -t awesome/docker-ansible:tag /any/build/context

Enjoy your Ansible image.

Super quick

If you want to go directly to the point, without building your own custom image, just run:

docker run -it --name awesome-ansible-container \
  -v ${HOME}/.ssh:/root/.ssh:ro \
  # ... additional configurations
  macunha1/ansible:alpine-3.11.5 \
  -- -i inventory/awesome playbook.yml

Why yet another Ansible image for Docker?

There has been quite a few Ansible images for Docker (e.g., search in the Docker Hub), so why reinvent the wheel?

Simply, because most of them seems to be abadoned. Even the base of this fork from William Yeh

Motivation

This repository was first created to give Confluent Kafka role a proper test suite. Previously, public images gave me a lot of issues, and I got tired of making workarounds to have a CI working for my roles.

If you're tired too of looking around and not finding what you need, join me and use these Docker images. Feel free to open issues and send PR, I will be happy to colaborate.

Use cases

With Docker, we can test any Ansible playbook against any version of any Linux distribution without the help of Vagrant. More lightweight, and more portable across IaaS providers.

If better OS emulation (virtualization) isn't required, the Docker approach (containerization) should give you a more quicker setup to test your Ansible playbooks.

Contribute

PRs Welcome

Feel free to fill an issue containing feature request(s), or (even better) to send me a Pull request, I would be happy to collaborate with you.

If this role didn't work for you, or if you found some bug during the execution, let me know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.