@ -55,7 +55,7 @@ Example of setting the ``debugger`` keyword on a task:
..code-block:: yaml
..code-block:: yaml
- name: Execute a command
- name: Execute a command
command: "false"
ansible.builtin.command: "false"
debugger: on_failed
debugger: on_failed
Example of setting the ``debugger`` keyword on a play:
Example of setting the ``debugger`` keyword on a play:
@ -67,7 +67,7 @@ Example of setting the ``debugger`` keyword on a play:
debugger: on_skipped
debugger: on_skipped
tasks:
tasks:
- name: Execute a command
- name: Execute a command
command: "true"
ansible.builtin.command: "true"
when: False
when: False
Example of setting the ``debugger`` keyword at multiple levels:
Example of setting the ``debugger`` keyword at multiple levels:
@ -80,7 +80,7 @@ Example of setting the ``debugger`` keyword at multiple levels:
debugger: never
debugger: never
tasks:
tasks:
- name: Execute a command
- name: Execute a command
command: "false"
ansible.builtin.command: "false"
debugger: on_failed
debugger: on_failed
In this example, the debugger is set to ``never`` at the play level and to ``on_failed`` at the task level. If the task fails, Ansible invokes the debugger, because the definition on the task overrides the definition on its parent play.
In this example, the debugger is set to ``never`` at the play level and to ``on_failed`` at the task level. If the task fails, Ansible invokes the debugger, because the definition on the task overrides the definition on its parent play.
@ -137,8 +137,8 @@ After Ansible invokes the debugger, you can use the seven :ref:`debugger command
vars:
vars:
var1: value1
var1: value1
tasks:
tasks:
- name: wrong variable
- name: Use a wrong variable
ping: data={{ wrong_var }}
ansible.builtin.ping: data={{ wrong_var }}
If you run this playbook, Ansible invokes the debugger when the task fails. From the debug prompt, you can change the module arguments or the variables and run the task again.
If you run this playbook, Ansible invokes the debugger when the task fails. From the debug prompt, you can change the module arguments or the variables and run the task again.
@ -248,8 +248,8 @@ Update args command
vars:
vars:
pkg_name: not_exist
pkg_name: not_exist
tasks:
tasks:
- name: install package
- name: Install a package
apt: name={{ pkg_name }}
ansible.builtin.apt: name={{ pkg_name }}
When you run the playbook, the invalid package name triggers an error, and Ansible invokes the debugger. You can fix the package name by viewing, then updating the module argument::
When you run the playbook, the invalid package name triggers an error, and Ansible invokes the debugger. You can fix the package name by viewing, then updating the module argument::