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.
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:
Some requirements:
- a local docker installation (Why not manage remote Docker install later)
- SSH key pair
You can install "pytest-ansible-docker" via pip from PyPI:
$ pip install pytest-ansible-docker
I only used this plugin to manage my role testing, locally and on Travis, you can check ìnfopen_role_template for example.
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.
Distributed under the terms of the MIT license, "pytest-ansible-docker" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.