Printing Text or Variables in Ansible
Learn how to print a text or variable in Ansible.
We often need to print messages or the variable’s value in Ansible. The statements can be text, Ansible variables, facts, and so on.
Ansible debug
module
The Ansible ansible.builtin.debug
module is a useful tool for displaying information during playbook execution. It allows us to print specific variables or custom messages to the standard output, providing insights into the state of the system or playbook execution. The debug
module is commonly used for debugging purposes, troubleshooting, or simply to gain more visibility into the Ansible playbook’s operations.
It can also be used to display messages, expressions, and variables in different formats, such as JSON, YAML, or plaintext. The output can be saved to a file or displayed in the console.