Loops — Ansible Documentation
docs.ansible.com › user_guide › playbooks_loopsThe list of all items in the loop. ansible_loop.index. The current iteration of the loop. (1 indexed) ansible_loop.index0. The current iteration of the loop. (0 indexed) ansible_loop.revindex. The number of iterations from the end of the loop (1 indexed) ansible_loop.revindex0. The number of iterations from the end of the loop (0 indexed) ansible_loop.first. True if first iteration. ansible_loop.last
Double with_items loop in ansible - Stack Overflow
stackoverflow.com › questions › 53116381There are two ways to make a nested (double) loop in Ansible. with_nested. It allows you to have an inner iteration for object you iterate in the outer loop. Examples and explanation are provided in the official documentation: https://docs.ansible.com/ansible/2.5/plugins/lookup/nested.html. using with_items together with include_tasks. This is a complicated yet powerful construction.