Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Pytest plugin to test Ansible roles and plays with testinfra, using Docker

License

Notifications You must be signed in to change notification settings

infOpen/pytest-ansible-docker

Repository files navigation

pytest-ansible-docker

See Build Status on Travis CI

Plugin to manage Ansible roles and plays testing with testinfra, using Docker containers


This Pytest plugin was generated with Cookiecutter along with @hackebrot's Cookiecutter-pytest-plugin template.

Features

This plugin help to manage Ansible roles and playbook testing with Docker, Testinfra and tox.

This plugin is used with my Ansible role template: ìnfopen_role_template.

For each Docker image configured, it:

  • create a Docker container on localhost
  • import ssh public key to root user account
  • create a temporary inventory file
  • run one or two provisions (second is used for idempotence testing) using SSH
  • execute all tests into the container.

If used with tox, you can manage quicly a matrix based testing:

  • tox manage X Ansible version
  • this plugin help to manage Y Docker systems

Requirements

Some requirements:

  • a local docker installation (Why not manage remote Docker install later)
  • SSH key pair

Installation

You can install "pytest-ansible-docker" via pip from PyPI:

$ pip install pytest-ansible-docker

Usage

I only used this plugin to manage my role testing, locally and on Travis, you can check ìnfopen_role_template for example.

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, "pytest-ansible-docker" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

About

Pytest plugin to test Ansible roles and plays with testinfra, using Docker

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages