ansible.builtin.junit – write playbook output to a JUnit file.
Note
This module is part of ansible-base
and included in all Ansible installations. In most cases, you can use the short module name junit even without specifying the collections:
keyword. Despite that, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
Synopsis
- This callback writes playbook output to a JUnit formatted XML file.
- Tasks show up in the report as follows: ‘ok’: pass ‘failed’ with ‘EXPECTED FAILURE’ in the task name: pass ‘failed’ with ‘TOGGLE RESULT’ in the task name: pass ‘ok’ with ‘TOGGLE RESULT’ in the task name: failure ‘failed’ due to an exception: error ‘failed’ for other reasons: failure ‘skipped’: skipped
Requirements
The below requirements are needed on the local controller node that executes this callback.
- whitelist in configuration
- junit_xml (python lib)
Parameters
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
fail_on_change string | Default: "no" | env:JUNIT_FAIL_ON_CHANGE | Consider any tasks reporting "changed" as a junit test failure |
fail_on_ignore string | Default: "no" | env:JUNIT_FAIL_ON_IGNORE | Consider failed tasks as a junit test failure even if ignore_on_error is set |
hide_task_arguments string added in 2.8 of ansible.builtin | Default: "no" | env:JUNIT_HIDE_TASK_ARGUMENTS | Hide the arguments for a task |
include_setup_tasks_in_report string | Default: "yes" | env:JUNIT_INCLUDE_SETUP_TASKS_IN_REPORT | Should the setup tasks be included in the final report |
output_dir string | Default: "~/.ansible.log" | env:JUNIT_OUTPUT_DIR | Directory to write XML files to. |
task_class string | Default: "no" | env:JUNIT_TASK_CLASS | Configure the output to be one class per yaml file |
task_relative_path string added in 2.8 of ansible.builtin | Default: "none" | env:JUNIT_TASK_RELATIVE_PATH | Configure the output to use relative paths to given directory |
test_case_prefix string added in 2.8 of ansible.builtin | Default: "\u003cempty\u003e" | env:JUNIT_TEST_CASE_PREFIX | Consider a task only as test case if it has this value as prefix. Additionaly failing tasks are recorded as failed test cases. |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/ansible/builtin/junit_callback.html