GithubHelp home page GithubHelp logo

imranansari / ansible-docker-runner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thomasjpfan/ansible-docker-runner

0.0 2.0 0.0 48 KB

Ansible runner for testing playbooks with docker connection

License: MIT License

Makefile 16.90% Shell 78.93% Python 4.17%

ansible-docker-runner's Introduction

thomasjpfan/ansible-docker-runner

Build Status

Ansible runner for testing playbooks with docker connection.

Usage

  1. Set up hosts using docker-compose:
docker-compose -f tests/docker-compose.yml up -d
  1. Mount volumes in thomasjpfan/ansible-docker-runner with your playbooks and run all
docker run --rm -v $PWD:/etc/ansible/roles/role_to_test \
  -v /var/run/docker.sock:/var/run/docker.sock:ro -ti \
  thomasjpfan/ansible-docker-runner cli all
  1. Notice that tests/playbook.yml names the role under testing: role_to_test.

Commands

  1. lint: Runs ansible-lint on tests/playbook.yml.
  2. syntax-check: Runs ansible-playbook --syntax-check on tests/playbook.yml with tests/inventory.
  3. converge: Runs ansible-playbook on tests/playbook.yml with tests/inventory.
  4. idempotence: Runs converge again and see if anthing changed.
  5. run_test: Runs test tests/run_tests.sh.
  6. requirements: Runs ansible-galaxy install on tests/requirements.yml.
  7. all: Runs lint, syntax_check, requirements, converge, idempotence.

Local Development

For local development, one can start a shell:

docker run --rm -v $PWD:/etc/ansible/roles/role_to_test \
  --name runner \
  -v /var/run/docker.sock:/var/run/docker.sock:ro -ti \
  thomasjpfan/ansible-docker-runner /bin/sh

And run the commands prefixed with cli, for example: cli lint.

Extra Features

  • Setting ANSIBLE_PLAYBOOK_ARGS in the env will be passed along to the ansible-playbook cli.
  • Any arguments after the command will be passed along to the ansible-playbook cli and overwrites ANSIBLE_PLAYBOOK_ARGS
  • Setting INVENTORY_PATH changes the default inventory path: tests/inventory.
  • Setting PLAYBOOK_PATH changes the default playbook path: tests/playbook.yml.
  • Setting REQUIREMENTS_PATH changes the default requirements path: requirements.yml.
  • Settings TEST_PATH changes the default test shell path: tests/run_tests.sh.

ansible-docker-runner's People

Contributors

thomasjpfan avatar

Watchers

 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.