# Output of the debug: msg: Module

**URL:** <https://forum.ansible.com/t/output-of-the-debug-msg-module/2901>\
**Category:** Get Help\
**Tags:** playbook\
**Created:** [December 14, 2023, 10:27am UTC](https://forum.ansible.com/t/output-of-the-debug-msg-module/2901 "2023-12-14T10:27:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slears](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@Slears](https://forum.ansible.com/u/Slears)\
**Post date:** [December 14, 2023, 10:27am UTC](https://forum.ansible.com/t/output-of-the-debug-msg-module/2901/1 "2023-12-14T10:27:37Z")

</div>

Hi everyone,  
I am pretty new to Ansible, and actualy I write different playbooks to automate tasks in a Cisco ACI Fabric. It works great but I stumble over some Problems here and there.

So just a quick question. I try to extract basic Switch Infos from my APIC with a playbook like this

- name: ACI\_add\_fabric\_nodes  
hosts: ACI\_Simulator  
gather\_facts: False  
connection: local  
vars:  
ansible\_command\_timeout: 500

the output I get is

TASK [Active Nodes] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [aci-sim] =\> (item={‘fabricNodeIdentP’: {‘attributes’: {‘annotation’: ‘orchestrator:ansible’, ‘childAction’: ‘’, ‘descr’: ‘’, ‘dn’: ‘uni/controller/nodeidentpol/nodep-TEP-1-101’, ‘extMngdBy’: ‘’, ‘extPoolId’: ‘0’, ‘fabricId’: ‘1’, ‘lcOwn’: ‘local’, ‘modTs’: ‘2023-11-23T09:03:38.399+00:00’, ‘monPolDn’: ‘uni/fabric/monfab-default’, ‘name’: ‘msgleaf1001i’, ‘nameAlias’: ‘’, ‘nodeId’: ‘1001’, ‘nodeType’: ‘unspecified’, ‘podId’: ‘1’, ‘role’: ‘leaf’, ‘serial’: ‘TEP-1-101’, ‘status’: ‘’, ‘uid’: ‘15374’, ‘userdom’: ‘:all:’}}}) =\> {  
“msg”: “Switch: msgleaf1001i, Role: leaf, POD: 1, Seriennummer: TEP-1-101”  
}  
ok: [aci-sim] =\> (item={‘fabricNodeIdentP’: {‘attributes’: {‘annotation’: ‘orchestrator:ansible’, ‘childAction’: ‘’, ‘descr’: ‘’, ‘dn’: ‘uni/controller/nodeidentpol/nodep-TEP-1-102’, ‘extMngdBy’: ‘’, ‘extPoolId’: ‘0’, ‘fabricId’: ‘1’, ‘lcOwn’: ‘local’, ‘modTs’: ‘2023-11-23T09:03:53.423+00:00’, ‘monPolDn’: ‘uni/fabric/monfab-default’, ‘name’: ‘msgleaf1002i’, ‘nameAlias’: ‘’, ‘nodeId’: ‘1002’, ‘nodeType’: ‘unspecified’, ‘podId’: ‘1’, ‘role’: ‘leaf’, ‘serial’: ‘TEP-1-102’, ‘status’: ‘’, ‘uid’: ‘15374’, ‘userdom’: ‘:all:’}}}) =\> {  
“msg”: “Switch: msgleaf1002i, Role: leaf, POD: 1, Seriennummer: TEP-1-102”  
}  
ok: [aci-sim] =\> (item={‘fabricNodeIdentP’: {‘attributes’: {‘annotation’: ‘orchestrator:ansible’, ‘childAction’: ‘’, ‘descr’: ‘’, ‘dn’: ‘uni/controller/nodeidentpol/nodep-TEP-1-103’, ‘extMngdBy’: ‘’, ‘extPoolId’: ‘0’, ‘fabricId’: ‘1’, ‘lcOwn’: ‘local’, ‘modTs’: ‘2023-11-23T09:03:54.557+00:00’, ‘monPolDn’: ‘uni/fabric/monfab-default’, ‘name’: ‘msgspine101i’, ‘nameAlias’: ‘’, ‘nodeId’: ‘101’, ‘nodeType’: ‘unspecified’, ‘podId’: ‘1’, ‘role’: ‘spine’, ‘serial’: ‘TEP-1-103’, ‘status’: ‘’, ‘uid’: ‘15374’, ‘userdom’: ‘:all:’}}}) =\> {  
“msg”: “Switch: msgspine101i, Role: spine, POD: 1, Seriennummer: TEP-1-103”  
}  
is it possible to just get the msg Part, like:

“msg”: “Switch: msgleaf1001i, Role: leaf, POD: 1, Seriennummer: TEP-1-101”  
“msg”: “Switch: msgleaf1002i, Role: leaf, POD: 1, Seriennummer: TEP-1-102”  
“msg”: “Switch: msgspine101i, Role: spine, POD: 1, Seriennummer: TEP-1-103”

Thank you very much!

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [December 14, 2023, 12:28pm UTC](https://forum.ansible.com/t/output-of-the-debug-msg-module/2901/2 "2023-12-14T12:28:01Z")

</div>

Welcome to the forum! I don’t have time for a longer answer, but here’s a first pointer that will already improve the output a lot: [Loops — Ansible Documentation](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#limiting-loop-output-with-label)

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [December 14, 2023, 12:28pm UTC](https://forum.ansible.com/t/output-of-the-debug-msg-module/2901/3 "2023-12-14T12:28:06Z")

</div>

Hi,

> is it possible to just get the msg Part

Yes, you could use [loop\_control with label key](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#limiting-loop-output-with-label).

---

<div class="post-metadata">

**Author:** ![Slears](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@Slears](https://forum.ansible.com/u/Slears)\
**Post date:** [December 14, 2023, 2:46pm UTC](https://forum.ansible.com/t/output-of-the-debug-msg-module/2901/4 "2023-12-14T14:46:35Z")

</div>

thank you very much, that did indeed the trick. haha I have a lot to learn, the Journey begins
