Coder Social home page Coder Social logo

ansibeer's Introduction

Ansibeer

Scripts for testing Ansible playbooks in a Docker container.

The name "Ansibeer" is derived from the similar project "Puppeteer" built for testing puppet modules in a Docker container.

Prerequisites

You need to have Docker installed.

Using it

$ ./run.sh --image <docker-image> <playbook>

Will run ansible-playbook inside a container and drop you to a prompt for inspecting the container afterwards. Your Ansible repository is assumed to be in $HOME/ansible or you can specify it either using the -a argument or by setting the ANSIBLE_HOME environment variable to point to its location.

The docker image needs to have Ansible installed. If this is not the case, you can put a Dockerfile that will install Ansible with the same name as the image in the dockerfiles directory and Ansibeer will build an image from that and use that instead of the original image.

There is a convenience script for using debian:stretch called stretch.sh. You could test on a Debian Stretch container with

$ ./stretch.sh <playbook>

The playbooks directory is in .gitignore, so that is a perfectly fine place for putting your experimental playbooks you want to test.

Testing systemd services and Docker containers

Ansibeer is running its docker container with a set of docker arguments that allows it to run systemd as the init process. This makes it possible for you to test that systemd services are installed and run properly.

If you want to test systemd services, you should make sure, the Docker image you're using has systemd installed.

It also mounts the Docker socket inside the container so you can spin up containers. The containers will be spun up on the host machine and not inside the Ansibeer container though. This makes it impossible to test docker containers that mount local files into the containers since Docker will look for the local files on the host rather than inside the Ansibeer container. I haven't found a solution to this problem besides running Docker in Docker using a privileged container and this is not really a path I'm likely to take.

ansibeer's People

Contributors

jipe avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

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.