Ansible test
Make testinfra easier with ansible repository.
Write your test directly in your roles
purpose of ansible-tests
I want to be able to write testinfra tests in my role and use my inventories and my playbooks to run them
Usages
ansible-tests --file-name tests.yml --inventory inventory/dev.ini
Test your ansible roles
Your tests should be in test directory inside your role :
nginx
├── defaults
│ └── main.yml
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
└── tests
└── test_nginx.py
Example of test file :
# tests/test_nginx.py
def test_check_nginx_is_installed(host):
nginx = host.package('nginx')
assert nginx.is_installed
def test_nginx_is_running(host):
nginx = host.service('nginx')
assert nginx.is_running
Example of corersponding task file :
# tasks/main.yml
---
- name: install nginx
package:
name: nginx
state: present
- name: start nginx
service:
name: nginx
state: started
Configure ansible-test
To run ansible test, you have to respect this requirements:
- your roles must be in
rolesdirectory - you must have a playbook or a file to describe the matching between tests and servers
tests.yml supported formats
- hosts: bdd
roles: postgres
- hosts: all
roles: secu
- hosts: all
roles:
- base
- secu
- hosts:
- bdd
- web-app
roles:
- role: secu
- role: users
- hosts: bdd:web-app
roles:
- role: secu
You should be able to use directly your playbook if you don't use stuff like !group to exclude some group
Metadata
Release files for ansible-tests 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ansible-tests-0.0.4.tar.gz | 2.9 kB | Without provenance | Details for ansible-tests-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ansible_tests-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for ansible_tests-0.0.4-py3-none-any.whl |
Total release size: 7.4 kB
Release files / ansible-tests-0.0.4.tar.gz
| Download URL | ansible-tests-0.0.4.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea05f9bcefedcd53de745e551550d63fbc64a5d0c79a1c3dd0e1a1983a1951e7
|
|
BLAKE2b-256 checksum How to use checksums |
98c5791bf2f74b0b6a850f25fad557a5275fe73ef18b7e98797de22e6ce83bee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2
|
Release files / ansible_tests-0.0.4-py3-none-any.whl
| Download URL | ansible_tests-0.0.4-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9be00f8e689bda063b139214943cc05c6ae55338b98dbd786205b5cbbe96b6fa
|
|
BLAKE2b-256 checksum How to use checksums |
817272f89cd63edee8d0d568daaa378b9425c4a38ab9efeb38783a5e21a97ca4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2
|
Security for ansible-tests 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.