ANSIBLE_ENABLE_TASK_DEBUGGER=True ansible-playbook -i hosts site.ymlinstall package (debug)> task.args['name'] = 'bash'install package (debug)> task_vars['pkg_name'] = 'bash' Ansible includes a debugger as part of the strategy plugins. fail – Fail with custom message The official documentation on the fail module. This module is also supported for Windows targets. You have access to all of the features of the debugger in the context of the task. unless otherwise explicitly disabled.This is a backwards compatible method, to match Ansible versions before 2.5,
You have access to all of the features of the debugger in the context of the task. Ansible Debug Module with Examples.
Ansible includes a debugger as part of the strategy plugins.
The playbook execution is aborted.
Notes ¶ Note. This debugger enables you to debug as task. [community] Authors¶ Kishin Yagami; Hint. Hint. Syntax1: Printing Variable Value. [preview] This strategy is maintained by the Ansible Community. If you notice any issues in this documentation, you can edit this document to improve it.
In the following examples I will show how to use debug module to print variable values, and print variables values with by adding some extra strings and printing variable with stdout.
You can then, for example, check or set the value of variables, update module arguments, and re-run the task with the new variables and arguments to help resolve the cause of the failure. More information about Red Hat’s support of this module is available from this If you notice any issues in this documentation, you can
assert – Asserts given expressions are true The official documentation on the assert module.
You can then, for example, check or set the value of variables, update module arguments, and re-run the task with the new variables and arguments to help resolve the cause of the failure.These options override any global configuration to enable or disable the debugger.When provided at a generic level and a more specific level, the more specific wins:When using this method, any failed or unreachable task will invoke the debugger, Use ansible-doc-t strategy
This debugger enables you to debug as task. A number that controls when the debug is run, if you set to 3 it will only run debug when -vvv or above. debug – Executes tasks in interactive debug session free – … and may be removed in a future releaseLet’s change the module’s arguments and run the task againDebugger is invoked due to wrong package name, so let’s fix the module’s args:This command re-creates the task from the original task data structure, and templates with updated Quit from the debugger. The message is nothing but any variable values or output of any task.