# debug msg ignore other results.

**URL:** <https://forum.ansible.com/t/debug-msg-ignore-other-results/31963>\
**Category:** Ansible Project\
**Created:** [January 14, 2020, 5:48am UTC](https://forum.ansible.com/t/debug-msg-ignore-other-results/31963 "2020-01-14T05:48:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jegansignup](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jegansignup](https://forum.ansible.com/u/jegansignup)\
**Post date:** [January 14, 2020, 5:48am UTC](https://forum.ansible.com/t/debug-msg-ignore-other-results/31963/1 "2020-01-14T05:48:30Z")

</div>

Hello Team,

I am iterating register result using debug and loop but it prints other variable result as well how to ignore that one while printing value which I want Below is the sample results. Cloud you please help me on this issues. I just want to print value of “item.invocation.module\_args.volume\_id” and ignore other results.

- debug:  
msg: “{{ item.invocation.module\_args.volume\_id }}”  
register: unused\_block  
with\_items: “{{result\_1.results}}”  
when: item.volume\_attachments | length == 0

debug result

TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: [localhost] =\> (item={‘failed’: False, ‘ansible\_loop\_var’: u’item’, u’volume\_attachments’: [{u’chap\_username’: None, u’time\_created’: u’2019-12-26T09:38:51.785000+00:00’, u’is\_read\_only’: False, u’volume\_id’: u’xxxxxxxxxxxx’, u’device’: None, u’xxxxxxxxxxx’, u’lifecycle\_state’: u’ATTACHED’, u’availability\_domain’: u’xxxxxxxxxx’, u’display\_name’: u’volumeattachment20191226093851’, u’compartment\_id’: u’xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’, u’port’: 3260, u’instance\_id’: u’xxxxxxxxxxxxxxxxxxxxx’, u’iqn’: u’xxxxxxxxxxxxxxxxxxxxx’, u’is\_pv\_encryption\_in\_transit\_enabled’: False, u’attachment\_type’: u’iscsi’, u’chap\_secret’: None, u’ipv4’: u’169.254.2.2’}], ‘item’: u’xxxxxxxxxxxxxxxxxxxxxxx’, u’invocation’: {u’module\_args’: {u’auth\_type’: u’api\_key’, u’api\_user\_key\_pass\_phrase’: None, u’availability\_domain’: None, u’display\_name’: None, u’config\_profile\_name’: u’root’, u’compartment\_id’: u’xxxxxxxxxxxxxxx’, u’region’: None, u’volume\_id’: u’xxxxxxxxxxxxxxxxxxxxxxx’, u’instance\_id’: None, u’tenancy’: None, u’api\_user\_key\_file’: None, u’api\_user\_fingerprint’: None, u’api\_user’: None,  
u’config\_file\_location’: u’~/.oci/config’, u’volume\_attachment\_id’: None}}, ‘changed’: False, ‘ansible\_facts’: {u’discovered\_interpreter\_python’: u’/usr/bin/python’}})

ok: [localhost] =\> (item={‘failed’: False, ‘ansible\_loop\_var’: u’item’, u’volume\_attachments’: , ‘item’: u’xxxxxxxxxxxxxxxxxxxxxxxx’, u’invocation’: {u’module\_args’: {u’auth\_type’: u’api\_key’, u’api\_user\_key\_pass\_phrase’: None, u’availability\_domain’: None, u’display\_name’: None, u’config\_profile\_name’: u’root’, u’compartment\_id’: u’xxxxxxxxxxxxxxxxxxxxxxxxxx’, u’region’: None, u’volume\_id’: u’xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’, u’instance\_id’: None, u’tenancy’: None, u’api\_user\_key\_file’: None, u’api\_user\_fingerprint’: None, u’api\_user’: None, u’config\_file\_location’: u’~/.oci/config’, u’volume\_attachment\_id’: None}}, ‘changed’: False}) =\> {  
“msg”: “xxxxxxxxxxxxxxxxxxxxxx”  
}

---

<div class="post-metadata">

**Author:** ![cassell](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@cassell](https://forum.ansible.com/u/cassell)\
**Post date:** [January 14, 2020, 9:32am UTC](https://forum.ansible.com/t/debug-msg-ignore-other-results/31963/2 "2020-01-14T09:32:25Z")

</div>

loop\_control:  
&nbsp;&nbsp;label: "{{ item.invocation.module\_args.volume\_id }}"

Or similar.

V/r,  
James Cassell

---

<div class="post-metadata">

**Author:** ![jegansignup](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jegansignup](https://forum.ansible.com/u/jegansignup)\
**Post date:** [January 14, 2020, 12:36pm UTC](https://forum.ansible.com/t/debug-msg-ignore-other-results/31963/3 "2020-01-14T12:36:30Z")

</div>

Thanks a lot. It is working for me.

---

<div class="post-metadata">

**Author:** ![acozine1](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@acozine1](https://forum.ansible.com/u/acozine1)\
**Post date:** [January 14, 2020, 8:12pm UTC](https://forum.ansible.com/t/debug-msg-ignore-other-results/31963/4 "2020-01-14T20:12:24Z")

</div>

For more details, see the section on “Adding controls to loops” here:

[https://docs.ansible.com/ansible/devel/user\_guide/playbooks\_loops.html](https://docs.ansible.com/ansible/devel/user_guide/playbooks_loops.html)
