# Item name in task name.

**URL:** <https://forum.ansible.com/t/item-name-in-task-name/26588>\
**Category:** Ansible Project\
**Created:** [January 29, 2018, 4:02pm UTC](https://forum.ansible.com/t/item-name-in-task-name/26588 "2018-01-29T16:02:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Varun\_Chopra](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@Varun\_Chopra](https://forum.ansible.com/u/Varun_Chopra)\
**Post date:** [January 29, 2018, 4:02pm UTC](https://forum.ansible.com/t/item-name-in-task-name/26588/1 "2018-01-29T16:02:58Z")

</div>

Hi,

I’m trying to display the item name in the name of the task but it doesn’t work as intended.

Here’s part of my play:

tasks:

- name: Installing {{ item }}  
yum:  
name: “{{ item }}”  
state: latest  
with\_items:
- httpd
- firewalld

This is what I get when I run the play:

TASK [Installing {{ item }}] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [[servera.example.com](http://servera.example.com)] =\> (item=[u’httpd’, u’firewalld’])

Is this supposed to work this way? I

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [January 31, 2018, 8:07pm UTC](https://forum.ansible.com/t/item-name-in-task-name/26588/2 "2018-01-31T20:07:49Z")

</div>

Try enclosing the name in double-quotes, e.g.,

`  
tasks:

- name: “Installing {{ item }}”  
yum:  
name: “{{ item }}”  
state: latest  
with\_items:
- httpd
- firewalld  
`

---

<div class="post-metadata">

**Author:** ![Malcolm\_Hussain-Gamb](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@Malcolm\_Hussain-Gamb](https://forum.ansible.com/u/Malcolm_Hussain-Gamb)\
**Post date:** [January 31, 2018, 10:26pm UTC](https://forum.ansible.com/t/item-name-in-task-name/26588/3 "2018-01-31T22:26:32Z")

</div>

I don't think you can do that, as the item isn't defined when it prints the name section. I also seem to remember that certain modules,like yum will process the list in one go. Rather than doing two yum installs.

---

<div class="post-metadata">

**Author:** ![Varun\_Chopra](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@Varun\_Chopra](https://forum.ansible.com/u/Varun_Chopra)\
**Post date:** [February 1, 2018, 3:10pm UTC](https://forum.ansible.com/t/item-name-in-task-name/26588/4 "2018-02-01T15:10:02Z")

</div>

This doesn’t matter.

---

<div class="post-metadata">

**Author:** ![Varun\_Chopra](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@Varun\_Chopra](https://forum.ansible.com/u/Varun_Chopra)\
**Post date:** [February 1, 2018, 3:10pm UTC](https://forum.ansible.com/t/item-name-in-task-name/26588/5 "2018-02-01T15:10:27Z")

</div>

Yeah, you’re right!

Thanks!

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [February 1, 2018, 3:21pm UTC](https://forum.ansible.com/t/item-name-in-task-name/26588/6 "2018-02-01T15:21:29Z")

</div>

There is a workaround to get if you want it, it involves include\_tasks.

file-to-include.yml
