Please note, this is a STATIC archive of website www.javatpoint.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
Javatpoint Logo
Javatpoint Logo

Ansible Debug

Ansible provides a debug module option that makes the tasks more manageable. It is a handy tool to figure out any problem areas.

Ansible version 2.1 extended the debug module with a verbosity parameter that transforms it from a print line.

For example: Let's create the playbook 1_debug_example.yml, such as:

During the Ansible playbook debugging, it is useful to know how to display the registered variables or host facts.

To print a message from the Ansible playbook, as well as a value of a variable, we can use the Ansible debug module. Ansible debug module is easy to use.

For example: Let's execute a simple hello world playbook 2_debug_example.yml, such as:

the Ansible includes a debugger as a part of the strategy plugins. This debugger enables you to debug as a task. You have access to all the features of the debugger in the context of the task. You can check or set the value of variables, update module arguments, and re-run the task with the new variables and arguments to resolve the cause of the failure.

There are many ways to invoke the debugger, such as:

Using the debugger Keyword

The debugger keyword can be used on any block where you provide a name attribute such as a role, block, task, or play.

The debugger keyword accepts several values, such as:

Always: Always invokes the debugger, regardless of the outcome.

Never: Never invokes the debugger, regardless of the outcome.

On_failed: It only invokes the debugger if a task fails.

On_unreachable: It only invokes the debugger if the host was unreachable.

On_skipped: It only invokes the debugger if the task is skipped.

NOTE: These options override any global configuration to enable or disable the debugger.

On a Task

On a play

When a provided at the general level, and a more specific level, the more particular wins:


Next TopicAnsible Apt





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA