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. I have a yaml file which come from a manifest list from outside ansible and it looks like this:
---
modules:
- ['module','version','extra']
- ['module2','version','extra']
- ['module3','version','extra']
My task looks like this:
task:
- include_vars: /path/to/external/file.yml
- name: install modules
yum: name={{item.0}} state=installed
with_items: "{{ modules }}"
When I run that I get:
fatal: [localhost]: FAILED! => {"failed": true, "msg": "ERROR! int object has no element 0"}
When I try:
- debug: msg="{{item}}"
with_items: "{{module}}"
it prints every element (module, version, extra, and so on), not just the sublist (which is what I would expect)