debug模块主要用于打印输出,特别适合于在 playbook 中打印一个变量结果,看看有没有达到自己预期的效果

Ansible技术问答:http://linux.xyz/topic/Ansible

示例:

- debug: msg="system {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }}"
when: ansible_default_ipv4.gateway is defined

- name: Display all variables/facts known for a host
 debug: var=hostvars[inventory_hostname] verbosity=4