I\'m trying to use ansible to loop over a list of lists to install some packages. But {{item}} is returning every element in the sub lists rather than the sublist itself.
Replace with_items: "{{ modules }}"
with:
in Ansible 2.5 and later (refer to with_list porting guide):
loop: "{{ modules }}"
in Ansible 2.0 and later:
with_list: "{{ modules }}"
in any Ansible pre-2.0:
with_items:
- "{{ modules }}"
This way you'd have three levels of nested lists, and the default behaviour flattens only two of them.