Ansible Output Label

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?

Are you aware of label? Or have I misunderstood your question?

1 Like

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.

Hi,

You should be able to achieve that using community.general.diy callback plugin.

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 !

2 Likes

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.

2 Likes

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