How do you use `debug` to inspect variables without being noisy?
BeginnerConceptPlaybooks, Plays, Tasks and Handlers
Answer
- ansible.builtin.debug:
var: ansible_facts['default_ipv4']['address']
- ansible.builtin.debug:
msg: "Deploying {{ app_version }} to {{ inventory_hostname }}"
verbosity: 2 # only show with -vv
var: prints the variable's value without needing {{ }}. verbosity keeps debug output out of normal runs. Do not debug secrets; use no_log: true on sensitive tasks instead.