Use JUnit callback plugin to store and Allure Framework to visualize ansible playbook events.


JUnit callback plugin requires junit_xml Python module.

[WARNING]: The `junit_xml` python module is not installed. Disabling the `junit` callback plugin.

Install it before using this callback plugin.

$ sudo apt install python3-junit.xml

Use environment variables to use JUnit callback plugin, define output directory and its behaviour.

$ ANSIBLE_STDOUT_CALLBACK=junit JUNIT_OUTPUT_DIR="junit-results" JUNIT_FAIL_ON_CHANGE=true JUNIT_HIDE_TASK_ARGUMENTS=true ansible-playbook -i inventory/hosts.yml --vault-password-file .vault_pass.txt --check playbooks/site.yml

It will create JUnit XML report in defined directory.

$ ls -l junit-results/
total 512
-rw-rw-r-- 1 milosz milosz 522393 Oct  3 21:49 lxd-1601754580.104396.xml

Allure Framework

Download command-line utility.

$ wget

Extract it to the /opt directory for example.

$ sudo tar -C /opt -xzf allure-commandline-2.13.6.tgz

Generate report locally.

$ /opt/allure-2.13.6/bin/allure generate junit-results --output junit-reports --clean
Report successfully generated to junit-reports

Open report in web-browser.

$ /opt/allure-2.13.6/bin/allure open junit-reports
Starting web server...
2020-10-03 22:30:19.347:INFO::main: Logging initialized @212ms to org.eclipse.jetty.util.log.StdErrLog
Server started at <>. Press <ctrl+C> to exit

Copy history directory from junit-reports to junit-results to see trends next time.

$ cp -r junit-reports/history junit-results/
Allure report


Take advantage of Jenkins JUnit plugin when using Jenkins as it will intsantly provide useful information about test results with minimum configuration required.

Additional notes

JUnit callback plugin definition.

See Allure 2.6.0 is not able to generate history trends in case of trouble with trends.