Hello,
You can use with_nested:
- shell: "echo {{item.0}} {{item.1}}"
with_nested:
- var1.values()
- var2
On Thursday, September 17, 2015 at 7:42:54 PM UTC+9, 廖鹏辉 wrote:
>
> Say I have two variable like these:
>
> var1:
> key1: val1
> key2: val2
> var2:
> - item1
> - item2
>
> Can I loop over these two variables like below?
>
> - shell: echo {{ item.0.value }} {{ item.1 }}
> with_dict: "{{ var1 }}"
> with_items: "{{ var2 }}"
>
> I have no idea to loop over these two variables together and don't wanna
> change the data type of the variables. Is there any way to achieve this
> kind of loop in ansible?
>
Regards,
--
YAEGASHI Takeshi <[email protected]>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d28f52a4-0f32-4db1-a0e5-a873e932cf9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.