So, I tried to do this, and found it didn't work. I wasn't terribly surprised, but it seems like a reasonable use-case.
The play is to be run on one host- a central server, and I have a list of groups that I want to perform actions for- for each host in each group. The code looks something like this: 1. vars: 2. group_list: [ 'group1', 'group2', 'group3' ] 3. my_script: /some/script/foo.sh 4. 5. tasks: 6. - name: Nested task 7. command: ${my_script} action-{{item.0}} "{{hostvars[item.1]['some_fact']}}" 8. with_nested: 9. - group_list 10. - groups[item.0] What happens is that ansible interprets "groups[item.0]" as a string and tries to iterate over it's characters. Seems like a valid use case, but I can understand that re-evaluating the inner list on each outer-loop may be challenging. It's easily enough accomplished by unrolling the outer loop, but moderately annoying that I can't reduce it to a nested loop. -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bede8bc3-2e35-4b66-b291-54fe29fe6ea0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.