{"id":117761,"date":"2026-10-25T10:40:54","date_gmt":"2026-10-25T02:40:54","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/117761.html"},"modified":"2026-10-25T10:40:54","modified_gmt":"2026-10-25T02:40:54","slug":"3-ansible-debug%e6%a8%a1%e5%9d%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/117761.html","title":{"rendered":"3-ansible debug\u6a21\u5757"},"content":{"rendered":"<p>ansible debug\u6a21\u5757\u662f\u6700\u5e38\u7528\u7684\u8c03\u8bd5\u6a21\u5757\uff0c\u7528\u4e8e\u8f93\u51fa\u53d8\u91cf\u3001\u8868\u8fbe\u5f0f\u6216\u81ea\u5b9a\u4e49\u4fe1\u606f\uff0c\u5728\u7f16\u5199\u548c\u6392\u67e5playbook\u65f6\u975e\u5e38\u6709\u7528\u3002<\/p>\n<h2>1.\u57fa\u672c\u8bed\u6cd5<\/h2>\n<p>&#8211; name: Debug message<br \/>\n      debug:<br \/>\n        msg: \\&#8221;Hello World\\&#8221;<\/p>\n<h2>2.\u6837\u4f8b<\/h2>\n<h3>1.debug\u57fa\u672c\u6d4b\u8bd5<\/h3>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; name: Debug message<br \/>\n      debug:<br \/>\n        msg: \\&#8221;Hello World\\&#8221;<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [Debug message] ******************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;msg\\&#8221;: \\&#8221;Hello World\\&#8221;<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<h3>2.\u8f93\u51fa\u53d8\u91cf(var)<\/h3>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; name: Show hostname<br \/>\n      debug:<br \/>\n        var: ansible_hostname<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [Show hostname] ******************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;ansible_hostname\\&#8221;: \\&#8221;patrolagent\\&#8221;<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<h3>3.\u67e5\u770b\u6ce8\u518c\u53d8\u91cf<\/h3>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; name: Show hostname<br \/>\n      shell: hostname<br \/>\n      register: hostname_result<\/p>\n<p>    &#8211; debug:<br \/>\n        var: hostname_result<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [Show hostname] ******************************************************************************************<br \/>\nchanged: [192.168.10.100]<\/p>\n<p>TASK [debug] **************************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;hostname_result\\&#8221;: {<br \/>\n        \\&#8221;changed\\&#8221;: true,<br \/>\n        \\&#8221;cmd\\&#8221;: \\&#8221;hostname\\&#8221;,<br \/>\n        \\&#8221;delta\\&#8221;: \\&#8221;0:00:00.002204\\&#8221;,<br \/>\n        \\&#8221;end\\&#8221;: \\&#8221;2026-07-13 15:56:09.473972\\&#8221;,<br \/>\n        \\&#8221;failed\\&#8221;: false,<br \/>\n        \\&#8221;rc\\&#8221;: 0,<br \/>\n        \\&#8221;start\\&#8221;: \\&#8221;2026-07-13 15:56:09.471768\\&#8221;,<br \/>\n        \\&#8221;stderr\\&#8221;: \\&#8221;\\&#8221;,<br \/>\n        \\&#8221;stderr_lines\\&#8221;: [],<br \/>\n        \\&#8221;stdout\\&#8221;: \\&#8221;patrolagent\\&#8221;,<br \/>\n        \\&#8221;stdout_lines\\&#8221;: [<br \/>\n            \\&#8221;patrolagent\\&#8221;<br \/>\n        ]<br \/>\n    }<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory] <\/p>\n<p>\u5982\u679c\u53ea\u60f3\u8f93\u51fa\u547d\u4ee4\u7ed3\u679c<\/p>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; name: Show hostname<br \/>\n      shell: hostname<br \/>\n      register: hostname_result<\/p>\n<p>    &#8211; debug:<br \/>\n        var: hostname_result.stdout<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [Show hostname] ******************************************************************************************<br \/>\nchanged: [192.168.10.100]<\/p>\n<p>TASK [debug] **************************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;hostname_result.stdout\\&#8221;: \\&#8221;patrolagent\\&#8221;<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<h3>4.\u8f93\u51fa\u81ea\u5b9a\u4e49\u4fe1\u606f(msg)<\/h3>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; debug:<br \/>\n        msg: \\&#8221;Current host is {<\/p>\n<p>  { ansible_hostname }}\\&#8221;<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [debug] **************************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;msg\\&#8221;: \\&#8221;Current host is patrolagent\\&#8221;<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<p>\u8f93\u51fa\u591a\u4e2a\u53d8\u91cf<\/p>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; debug:<br \/>\n        msg:<br \/>\n         &#8211; \\&#8221;Hostname: {<\/p>\n<p>  { ansible_hostname }}\\&#8221;<br \/>\n         &#8211; \\&#8221;IP: {<\/p>\n<p>  { ansible_default_ipv4.address }}\\&#8221;<br \/>\n         &#8211; \\&#8221;OS: {<\/p>\n<p>  { ansible_distribution }}\\&#8221;<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [debug] **************************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;msg\\&#8221;: [<br \/>\n        \\&#8221;Hostname: patrolagent\\&#8221;,<br \/>\n        \\&#8221;IP: 192.168.10.100\\&#8221;,<br \/>\n        \\&#8221;OS: RedHat\\&#8221;<br \/>\n    ]<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<h3>5.\u8f93\u51fa\u8868\u8fbe\u5f0f\u7ed3\u679c<\/h3>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; debug:<br \/>\n        msg: \\&#8221;{<\/p>\n<p>  { 10 + 20 }}\\&#8221;<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [debug] **************************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;msg\\&#8221;: \\&#8221;30\\&#8221;<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<p>\u5224\u65ad\u6761\u4ef6<\/p>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; debug:<br \/>\n        msg: \\&#8221;{<\/p>\n<p>  { ansible_memtotal_mb &gt; 4096 }}\\&#8221;<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [debug] **************************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;msg\\&#8221;: false<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<h3>6.\u914d\u5408when<\/h3>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; debug:<br \/>\n        msg: \\&#8221;Memory is greater than 4GB\\&#8221;<br \/>\n      when: ansible_memtotal_mb &gt; 4096<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [debug] **************************************************************************************************<br \/>\nskipping: [192.168.10.100]<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=1    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<h3>7.\u914d\u5408register<\/h3>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; name: Check nginx<br \/>\n      shell: systemctl is-active PatrolAgent<br \/>\n      register: pa_status<\/p>\n<p>    &#8211; name: Pa output<br \/>\n      debug:<br \/>\n        var: pa_status.stdout<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [Check nginx] ********************************************************************************************<br \/>\nchanged: [192.168.10.100]<\/p>\n<p>TASK [Pa output] **********************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;pa_status.stdout\\&#8221;: \\&#8221;active\\&#8221;<br \/>\n}<\/p>\n<p>PLAY RECAP ****************************************************************************************************<br \/>\n192.168.10.100             : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   <\/p>\n<p>[root@cent79-2 yaml-directory]# <\/p>\n<h3>8.\u67e5\u770b\u6240\u6709Facts<\/h3>\n<p>&#8211; hosts: all<\/p>\n<p>  tasks:<br \/>\n    &#8211; name: Facts output<br \/>\n      debug:<br \/>\n        var: ansible_facts<\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p>[root@cent79-2 yaml-directory]# ansible-playbook debug.yaml <\/p>\n<p>PLAY [all] ****************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] ****************************************************************************************<br \/>\nok: [192.168.10.100]<\/p>\n<p>TASK [Facts output] *******************************************************************************************<br \/>\nok: [192.168.10.100] =&gt; {<br \/>\n    \\&#8221;ansible_facts\\&#8221;: {<br \/>\n        \\&#8221;all_ipv4_addresses\\&#8221;: [<br \/>\n            \\&#8221;192.168.10.100\\&#8221;,<br \/>\n            \\&#8221;192.168.10.111\\&#8221;<br \/>\n        ],<br \/>\n        \\&#8221;all_ipv6_addresses\\&#8221;: [<br \/>\n            \\&#8221;fe80::6a88:30a0:2d04:24ed\\&#8221;<br \/>\n        ],<br \/>\n        \\&#8221;ansible_local\\&#8221;: {},<br \/>\n        \\&#8221;apparmor\\&#8221;: {<br \/>\n            \\&#8221;status\\&#8221;: \\&#8221;disabled\\&#8221;<br \/>\n        },<br \/>\n        \\&#8221;architecture\\&#8221;: \\&#8221;x86_64\\&#8221;,<br \/>\n        \\&#8221;bios_date\\&#8221;: \\&#8221;11\/12\/2020\\&#8221;,<br \/>\n        \\&#8221;bios_version\\&#8221;: \\&#8221;6.00\\&#8221;,<br \/>\n        \\&#8221;cmdline\\&#8221;: {<br \/>\n            \\&#8221;BOOT_IMAGE\\&#8221;: \\&#8221;\/vmlinuz-3.10.0-693.el7.x86_64\\&#8221;,<br \/>\n            \\&#8221;LANG\\&#8221;: \\&#8221;en_US.UTF-8\\&#8221;,<br \/>\n            \\&#8221;quiet\\&#8221;: true,<br \/>\n            \\&#8221;rd.lvm.lv\\&#8221;: \\&#8221;rhel_patrolagent\/swap\\&#8221;,<br \/>\n            \\&#8221;rhgb\\&#8221;: true,<br \/>\n            \\&#8221;ro\\&#8221;: true,<br \/>\n            \\&#8221;root\\&#8221;: \\&#8221;\/dev\/mapper\/rhel_patrolagent-root\\&#8221;<br \/>\n        },<br \/>\n        \\&#8221;date_time\\&#8221;: {<br \/>\n            \\&#8221;date\\&#8221;: \\&#8221;2026-07-13\\&#8221;,<br \/>\n            \\&#8221;day\\&#8221;: \\&#8221;13\\&#8221;,<br \/>\n            \\&#8221;epoch\\&#8221;: \\&#8221;1783932084\\&#8221;,<br \/>\n            \\&#8221;hour\\&#8221;: \\&#8221;16\\&#8221;,<br \/>\n            \\&#8221;iso8601\\&#8221;: \\&#8221;2026-07-13T08:41:24Z\\&#8221;,<br \/>\n            \\&#8221;iso8601_basic\\&#8221;: \\&#8221;20260713T164124285920\\&#8221;,<br \/>\n            \\&#8221;iso8601_basic_short\\&#8221;: \\&#8221;20260713T164124\\&#8221;,<br \/>\n            \\&#8221;iso8601_micro\\&#8221;: \\&#8221;2026-07-13T08:41:24.285920Z\\&#8221;,<br \/>\n            \\&#8221;minute\\&#8221;: \\&#8221;41\\&#8221;,<br \/>\n            \\&#8221;month\\&#8221;: \\&#8221;07\\&#8221;,<br \/>\n            \\&#8221;second\\&#8221;: \\&#8221;24\\&#8221;,<br \/>\n            \\&#8221;time\\&#8221;: \\&#8221;16:41:24\\&#8221;,<br \/>\n            \\&#8221;tz\\&#8221;: \\&#8221;CST\\&#8221;,<br \/>\n            \\&#8221;tz_offset\\&#8221;: \\&#8221;+0800\\&#8221;,<br \/>\n            \\&#8221;weekday\\&#8221;: \\&#8221;Monday\\&#8221;,<br \/>\n            \\&#8221;weekday_number\\&#8221;: \\&#8221;1\\&#8221;,<br \/>\n            \\&#8221;weeknumber\\&#8221;: \\&#8221;28\\&#8221;,<br \/>\n            \\&#8221;year\\&#8221;: \\&#8221;2026\\&#8221;<br \/>\n        },<br \/>\n        \\&#8221;default_ipv4\\&#8221;: {<br \/>\n            \\&#8221;address\\&#8221;: \\&#8221;192.168.10.100\\&#8221;,<br \/>\n            \\&#8221;alias\\&#8221;: \\&#8221;ens33\\&#8221;,<br \/>\n            \\&#8221;broadcast\\&#8221;: \\&#8221;192.168.10.255\\&#8221;,<br \/>\n            \\&#8221;gateway\\&#8221;: \\&#8221;192.168.10.1\\&#8221;,<br \/>\n            \\&#8221;interface\\&#8221;: \\&#8221;ens33\\&#8221;,<br \/>\n            \\&#8221;macaddress\\&#8221;: \\&#8221;00:0c:29:7c:8d:7b\\&#8221;,<br \/>\n            \\&#8221;mtu\\&#8221;: 1500,<br \/>\n            \\&#8221;netmask\\&#8221;: \\&#8221;255.255.255.0\\&#8221;,<br \/>\n            \\&#8221;network\\&#8221;: \\&#8221;192.168.10.0\\&#8221;,<br \/>\n            \\&#8221;type\\&#8221;: \\&#8221;ether\\&#8221;<br \/>\n        },<br \/>\n        \\&#8221;default_ipv6\\&#8221;: {},<br \/>\n        \\&#8221;device_links\\&#8221;: {<br \/>\n            \\&#8221;ids\\&#8221;: {<br \/>\n                \\&#8221;dm-0\\&#8221;: [<br \/>\n                    \\&#8221;dm-name-rhel_patrolagent-root\\&#8221;,<br \/>\n                    \\&#8221;dm-uuid-LVM-UlaebvSQUYHFSvRiRiQgmUk4M2n1X4fBSE24QCo1EkXin4VkULSH3U6xkiCLvACC\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;dm-1\\&#8221;: [<br \/>\n                    \\&#8221;dm-name-rhel_patrolagent-swap\\&#8221;,<br \/>\n                    \\&#8221;dm-uuid-LVM-UlaebvSQUYHFSvRiRiQgmUk4M2n1X4fBrcpQr58KLciodrOxFf1dy2iwzJ7XfOe5\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;dm-2\\&#8221;: [<br \/>\n                    \\&#8221;dm-name-rhel_patrolagent-var\\&#8221;,<br \/>\n                    \\&#8221;dm-uuid-LVM-UlaebvSQUYHFSvRiRiQgmUk4M2n1X4fBPZ1fz70wHTdVNEixh4KNjJEILFyr1HVJ\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;dm-3\\&#8221;: [<br \/>\n                    \\&#8221;dm-name-rhel_patrolagent-home\\&#8221;,<br \/>\n                    \\&#8221;dm-uuid-LVM-UlaebvSQUYHFSvRiRiQgmUk4M2n1X4fBxk2EgXPcz21MGa9t2DafrOOVgZzgDNPC\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;sda2\\&#8221;: [<br \/>\n                    \\&#8221;lvm-pv-uuid-VRgGxq-GkDc-m54A-5T1D-j4MQ-hwCj-YP32cV\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;sr0\\&#8221;: [<br \/>\n                    \\&#8221;ata-VMware_Virtual_SATA_CDRW_Drive_01000000000000000001\\&#8221;<br \/>\n                ]<br \/>\n            },<br \/>\n            \\&#8221;labels\\&#8221;: {<br \/>\n                \\&#8221;sr0\\&#8221;: [<br \/>\n                    \\&#8221;RHEL-7.4\\\\\\\\x20Server.x86_64\\&#8221;<br \/>\n                ]<br \/>\n            },<br \/>\n            \\&#8221;masters\\&#8221;: {<br \/>\n                \\&#8221;sda2\\&#8221;: [<br \/>\n                    \\&#8221;dm-0\\&#8221;,<br \/>\n                    \\&#8221;dm-1\\&#8221;,<br \/>\n                    \\&#8221;dm-2\\&#8221;,<br \/>\n                    \\&#8221;dm-3\\&#8221;<br \/>\n                ]<br \/>\n            },<br \/>\n            \\&#8221;uuids\\&#8221;: {<br \/>\n                \\&#8221;dm-0\\&#8221;: [<br \/>\n                    \\&#8221;f50ba8b5-e369-4235-8c3b-1e7b6d0bda48\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;dm-1\\&#8221;: [<br \/>\n                    \\&#8221;30d1fee5-cb49-489c-b787-e33ee0a9b131\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;dm-2\\&#8221;: [<br \/>\n                    \\&#8221;c3b19f3a-71ee-450b-9d34-956675a278a1\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;dm-3\\&#8221;: [<br \/>\n                    \\&#8221;f9f9733b-9aa4-4d7d-84b8-40d4f53d412d\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;sda1\\&#8221;: [<br \/>\n                    \\&#8221;bc617ee4-b4e6-4f09-9a4b-2025d80e4684\\&#8221;<br \/>\n                ],<br \/>\n                \\&#8221;sr0\\&#8221;: [<br \/>\n                    \\&#8221;2017-07-11-01-39-24-00\\&#8221;<br \/>\n                ]<br \/>\n            }<br \/>\n        },<br \/>\n        \\&#8221;devices\\&#8221;: {<br \/>\n            \\&#8221;dm-0\\&#8221;: {<br \/>\n                \\&#8221;holders\\&#8221;: []<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ansible debug\u6a21\u5757\u662f\u6700\u5e38\u7528\u7684\u8c03\u8bd5\u6a21\u5757\uff0c\u7528\u4e8e\u8f93\u51fa\u53d8\u91cf\u3001\u8868\u8fbe\u5f0f\u6216\u81ea\u5b9a\u4e49\u4fe1\u606f\uff0c\u5728\u7f16\u5199\u548c\u6392\u67e5playbook\u65f6\u975e\u5e38\u6709\u7528\u3002<br \/>\n1.\u57fa\u672c\u8bed\u6cd5<br \/>\n&#8211; name: Debug messagedebug:msg: \\&#8221;Hello World\\&#8221;2.\u6837\u4f8b<br \/>\n1.debug\u57fa\u672c\u6d4b\u8bd5<br \/>\n&#8211; hosts: alltasks:- name: Debug messagedebug:msg: \\&#8221;Hello World\\&#8221;\u8f93\u51fa\uff1a<br \/>\n[root@cent79-2 yaml-directory]# ansi<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1064,4401],"topic":[],"class_list":["post-117761","post","type-post","status-publish","format-standard","hentry","category-server","tag-ansible","tag-debug"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>3-ansible debug\u6a21\u5757 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/117761.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"3-ansible debug\u6a21\u5757 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"ansible debug\u6a21\u5757\u662f\u6700\u5e38\u7528\u7684\u8c03\u8bd5\u6a21\u5757\uff0c\u7528\u4e8e\u8f93\u51fa\u53d8\u91cf\u3001\u8868\u8fbe\u5f0f\u6216\u81ea\u5b9a\u4e49\u4fe1\u606f\uff0c\u5728\u7f16\u5199\u548c\u6392\u67e5playbook\u65f6\u975e\u5e38\u6709\u7528\u3002 1.\u57fa\u672c\u8bed\u6cd5 - name: Debug messagedebug:msg: &quot;Hello World&quot;2.\u6837\u4f8b 1.debug\u57fa\u672c\u6d4b\u8bd5 - hosts: alltasks:- name: Debug messagedebug:msg: &quot;Hello World&quot;\u8f93\u51fa\uff1a [root@cent79-2 yaml-directory]# ansi\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/117761.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-25T02:40:54+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/117761.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/117761.html\",\"name\":\"3-ansible debug\u6a21\u5757 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-25T02:40:54+00:00\",\"dateModified\":\"2026-10-25T02:40:54+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/117761.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/117761.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/117761.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"3-ansible debug\u6a21\u5757\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"3-ansible debug\u6a21\u5757 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/117761.html","og_locale":"zh_CN","og_type":"article","og_title":"3-ansible debug\u6a21\u5757 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"ansible debug\u6a21\u5757\u662f\u6700\u5e38\u7528\u7684\u8c03\u8bd5\u6a21\u5757\uff0c\u7528\u4e8e\u8f93\u51fa\u53d8\u91cf\u3001\u8868\u8fbe\u5f0f\u6216\u81ea\u5b9a\u4e49\u4fe1\u606f\uff0c\u5728\u7f16\u5199\u548c\u6392\u67e5playbook\u65f6\u975e\u5e38\u6709\u7528\u3002 1.\u57fa\u672c\u8bed\u6cd5 - name: Debug messagedebug:msg: \"Hello World\"2.\u6837\u4f8b 1.debug\u57fa\u672c\u6d4b\u8bd5 - hosts: alltasks:- name: Debug messagedebug:msg: \"Hello World\"\u8f93\u51fa\uff1a [root@cent79-2 yaml-directory]# ansi","og_url":"https:\/\/www.wsisp.com\/helps\/117761.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-25T02:40:54+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/117761.html","url":"https:\/\/www.wsisp.com\/helps\/117761.html","name":"3-ansible debug\u6a21\u5757 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-25T02:40:54+00:00","dateModified":"2026-10-25T02:40:54+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/117761.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/117761.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/117761.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"3-ansible debug\u6a21\u5757"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/117761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=117761"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/117761\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=117761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=117761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=117761"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=117761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}