# Ansible Output Label

**URL:** <https://forum.ansible.com/t/ansible-output-label/3786>\
**Category:** Get Help\
**Created:** [February 9, 2024, 3:46pm UTC](https://forum.ansible.com/t/ansible-output-label/3786 "2024-02-09T15:46:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [February 9, 2024, 3:46pm UTC](https://forum.ansible.com/t/ansible-output-label/3786/1 "2024-02-09T15:46:14Z")

</div>

Is there a way to change the output label of a task?

I want to do something similar to loops and loop\_var, but I don’t want to have to loop.

Any tips?

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [February 9, 2024, 5:25pm UTC](https://forum.ansible.com/t/ansible-output-label/3786/2 "2024-02-09T17:25:50Z")

</div>

Are you aware of [label](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#limiting-loop-output-with-label)? Or have I misunderstood your question?

---

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [February 9, 2024, 5:40pm UTC](https://forum.ansible.com/t/ansible-output-label/3786/3 "2024-02-09T17:40:16Z")

</div>

I want to do the same thing, but no for a task that is looped.

For example, here’s a normal output:  
TASK [FETCH ALL VIRTUAL SERVERS FROM PARTITION] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [DEVICE\_01]  
ok: [DEVICE\_02]

Partition is a variable. So, I’d like the output to look like similar to this:  
TASK [FETCH ALL VIRTUAL SERVERS FROM PARTITION] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [DEVICE\_01]=\>PARTITION\_01  
ok: [DEVICE\_02]=\>PARTITION\_01

The problem I have is, this task is not looped. It’s just a normally executed task.

---

<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:** [February 13, 2024, 7:44pm UTC](https://forum.ansible.com/t/ansible-output-label/3786/4 "2024-02-13T19:44:16Z")

</div>

Hi,

You should be able to achieve that using [community.general.diy callback plugin](https://docs.ansible.com/ansible/latest/collections/community/general/diy_callback.html).

I don’t have any example for this specific usecase, but I’m sure showcase examples on doc page will put you on the right track !

---

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [February 13, 2024, 7:58pm UTC](https://forum.ansible.com/t/ansible-output-label/3786/5 "2024-02-13T19:58:42Z")

</div>

Thank you, @ptn. This was the best solution I could find int he documentation and using Google. I was hoping for a simpler one-line I could put into my playbook for a single play, but I’ll work with what I have.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 14, 2024, 7:59pm UTC](https://forum.ansible.com/t/ansible-output-label/3786/6 "2024-03-14T19:59:35Z")

</div>

Closed on March 14, 2024, 7:59pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
