Hi :
I am trying to pass a array variable to an task with "with_item" clause, and would like to know whether there is support for this or any other alternative ways.
Thanks,
- name:print eth action: command echo $item with_items: -$ansible_interfaces
Output
TASK: [print eth] *********
ok: [192.168.0.15] => command echo $item
ok: [192.168.0.14] => command echo $item
ok: [192.168.0.13] => command echo $item
Which version of Ansible are you running?
So with_items taking a variable doesn't presently exist. It must take an explicit list.
FWIW, When it does, it would look like this:
with_items: $ansible_interfaces
Because a list of one item containing a list of multiple items wouldn't make sense.
There's a ticket already open for this feature.
By the way, I discovered that you can use YAML’s “repeated nodes”[1] feature to repeat a piece of the current YAML doc’s tree in multiple places.