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 ] => (item=[u’httpd’, u’firewalld’])
Is this supposed to work this way? I
ZillaYT
(ZillaYT)
January 31, 2018, 8:07pm
2
Try enclosing the name in double-quotes, e.g.,
`
tasks:
name: “Installing {{ item }}”
yum:
name: “{{ item }}”
state: latest
with_items:
httpd
firewalld
`
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.
There is a workaround to get if you want it, it involves include_tasks.
file-to-include.yml