* Provide a way to explicitly invoke the debugger with in the debug strategy
* Merge the debugger strategy into StrategyBase
* Fix some logic, pin to a single result
* Make redo also continue
* Make sure that if the debug closure doesn't need to process the result, that we still return it
* Fix failing tests for the strategy
* Clean up messages from debugger and exit code to match bin/ansible
* Move the FieldAttribute higher, to apply at different levels
* make debugger a string, expand logic
* Better host state rollbacks
* More explicit debugger prompt
* ENABLE_TASK_DEBUGGER should be boolean, and better docs
* No bare except, add pprint, alias h, vars to task_vars
* _validate_debugger can ignore non-string, that can be caught later
* Address issue if there were no previous tasks/state, and use the correct key
* Update docs for changes to the debugger
* Guard against a stat going negative through use of decrement
* Add a few notes about using the debugger on the free strategy
* Add changelog entry for task debugger
* Add a few versionadded indicators and a note about vars -> task_vars
Ansible includes a ``debug`` strategy. This strategy enables you to invoke a debugger when a task has
failed. You have access to all of the features of the debugger in the context of the failed task. You can then, for example, check or set the value of variables, update module arguments, and re-run the failed task with the new variables and arguments to help resolve the cause of the failure.
Ansible includes a debugger as part of the strategy plugins. This debugger enables you to debug as task.
You have access to all of the features of the debugger in the context of the task. 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.
There are multiple ways to invoke the debugger.
Using the debugger keyword
++++++++++++++++++++++++++
..versionadded:: 2.5
The ``debugger`` keyword can be used on any block where you provide a ``name`` attribute, such as a play, role, block or task.
The ``debugger`` keyword accepts several values:
always
Always invoke the debugger, regardless of the outcome
never
Never invoke the debugger, regardless of the outcome
on_failed
Only invoke the debugger if a task fails
on_unreachable
Only invoke the debugger if the a host was unreachable
on_skipped
Only invoke the debugger if the task is skipped
These options override any global configuration to enable or disable the debugger.
On a task
`````````
::
- name: Execute a command
command: false
debugger: on_failed
On a play
`````````
::
- name: Play
hosts: all
debugger: on_skipped
tasks:
- name: Execute a command
command: true
when: False
When provided at a generic level and a more specific level, the more specific wins::