In some cases, we need to run a task inside an Ansible playbook to loop over some data. Ansible's loops allow us to loop over a variable (a dictionary or a list) multiple times in order to achieve this behavior. In this recipe, we will outline how to use Ansible's loops.
In order to follow along with this recipe, an Ansible inventory file must be present and configured, as outlined in the previous recipes.
- Create a new playbook called ansible_loops.yml inside the ch1_ansible folder.
- Inside the group_vars...