debug
debug module
Print debug information during playbook execution. Use this module to display variable values, messages, or other debugging information.
Examples
- name: Print a simple message
debug:
msg: "Hello, World!"
- name: Display variable content
debug:
var: ansible_hostname
- name: Print variable with message
debug:
msg: "The hostname is {{ ansible_hostname }}"
- name: Debug complex data structures
debug:
var: my_dict
- name: Conditional debug
debug:
msg: "This will only print if condition is true"
when: some_condition
Note: Debug output is always displayed, even in check mode.
Module Capabilities
- Has Revert: true
- Provides Variables: None
Inputs
Parameter | Type | Description | Required | Default | Choices |
---|---|---|---|---|---|
msg | any | Message to display. Can be a string, list, or templated content. Cannot be used with 'var'. | false | ||
var | string | Name of variable to display. Cannot be used with 'msg'. | false |
Outputs
No outputs.