#
Ansible Loops
This tutorial explains to you how to use loops in Ansible. This tutorial has an example as well.
Ansible loops are used in playbooks and are very similar to using loops in any programming language. It helps you to loop through a list of variable in the playbook and do a task for each value.
Here it is an example of using a simple loop:
Here it is the execution of the playbook :
The same execution is written using "with_item":
Here it is an example of using "with_file":
For more examples of usage of with_* you can go to the Ansible official site.