online help: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/debug_module.html
offline help: ansible-doc debug (run this command on the ansible control node)
## PLAYBOOK
---
- name: ansible debug module - example 1
hosts: all
become: True
tasks:
- name: debug by printing messages or variables
shell: uptime
register: results
- name: Debug by printing messages
debug: msg="{{ results.stdout_lines }}"
- name: Debug by printing variables
debug: var=results.stdout_lines
- name: get file stat to display info on multiple lines
stat:
path: /home/ansible/hello.txt
register: fileinfo
- debug:
msg:
- "line1: path={{fileinfo.stat.path}}"
- "line2: mtime={{fileinfo.stat.mtime}}"
- "line3: atime={{fileinfo.stat.atime}}"
## OUTPUT
PLAY [ansible debug module - example 1] PLAY [ansible debug module - example 1] ************************************************************