# How to control output of a particular task

**URL:** <https://forum.ansible.com/t/how-to-control-output-of-a-particular-task/23796>\
**Category:** Ansible Project\
**Created:** [February 22, 2017, 3:07pm UTC](https://forum.ansible.com/t/how-to-control-output-of-a-particular-task/23796 "2017-02-22T15:07:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesus\_Cea](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@Jesus\_Cea](https://forum.ansible.com/u/Jesus_Cea)\
**Post date:** [February 22, 2017, 3:07pm UTC](https://forum.ansible.com/t/how-to-control-output-of-a-particular-task/23796/1 "2017-02-22T15:07:29Z")

</div>

I kind of remember reading about this in the documentation, but I have  
spend an hour trying to find it with no success.

I am iterating over huge structures and the task is showing the complete  
structure on the screen. I would like to show only a particular field.

Example:

"""  
- name: Test directories  
&nbsp;&nbsp;stat: path=/var/spool/nullmailer/{{ item }}  
&nbsp;&nbsp;register: directories  
&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;- queue  
&nbsp;&nbsp;&nbsp;&nbsp;- tmp

- name: Delete directories, if they are actual directories  
&nbsp;&nbsp;file: path=/var/spool/nullmailer/{{ item.item }} state=absent  
&nbsp;&nbsp;when: item.stat.isdir is defined and item.stat.isdir  
&nbsp;&nbsp;with\_items: "{{ directories.results }}"  
"""

The second task will print the complete "item" entry, including the  
complete "stat" structure per directory. I would like to print only, for  
example. "item.item" or "item.path".

Thanks.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 22, 2017, 7:47pm UTC](https://forum.ansible.com/t/how-to-control-output-of-a-particular-task/23796/2 "2017-02-22T19:47:08Z")

</div>

i believe this is what you want  
[http://docs.ansible.com/ansible/playbooks\_loops.html#loop-control](http://docs.ansible.com/ansible/playbooks_loops.html#loop-control),  
specifically the label option

---

<div class="post-metadata">

**Author:** ![Jesus\_Cea](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@Jesus\_Cea](https://forum.ansible.com/u/Jesus_Cea)\
**Post date:** [February 22, 2017, 8:09pm UTC](https://forum.ansible.com/t/how-to-control-output-of-a-particular-task/23796/3 "2017-02-22T20:09:18Z")

</div>

THAT ONE!. Thanks.
