# LOOP\_CONTROL with ansible

**URL:** <https://forum.ansible.com/t/loop-control-with-ansible/29023>\
**Category:** Ansible Project\
**Created:** [November 14, 2018, 2:09am UTC](https://forum.ansible.com/t/loop-control-with-ansible/29023 "2018-11-14T02:09:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhara\_Patel](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@Dhara\_Patel](https://forum.ansible.com/u/Dhara_Patel)\
**Post date:** [November 14, 2018, 2:09am UTC](https://forum.ansible.com/t/loop-control-with-ansible/29023/1 "2018-11-14T02:09:27Z")

</div>

Hi,

When i run my playbook i run into this issue. It pops us as Warning.

**[WARNING]: The loop variable ‘item’ is already in use. You should set the `loop_var` value in the `loop_control` option**

**for the task to something else to avoid variable collisions and unexpected behavior.**

**main.yml**

- include: groups.yml

groups.yml

- include: ec2\_gr.yml

ec2\_gr.yml

| 
- name: ‘ec2 groups’

 |
| | 

ec2\_group:

 |
| | 

name: ‘{{ item.key }}’

 |
| | 

description: ‘{{ item.value.description }}’

 |
| | 

vpc\_id: ‘{{ vpc\_net\_facts.id }}’

 |
| | 

region: ‘{{ region }}’

 |
| | 

rules: ‘{{ item.value.rules }}’

 |
| | |
| | 

rules\_egress: ‘{{ default\_egress\_rule if item.value.rules\_egress is not defined else item.value.rules\_egress }}’

 |
| | 

when: ec2groups is defined

 |
| | 

with\_dict: ‘{{ ec2groups | default({}) }}’

 |
| | 

register: tag\_ec2groups

 |
| | |
| | 
- set\_fact:

 |
| | 

group: ‘{{ ec2groups.keys() + group }}’

 |
| | 

when: ec2groups is defined I see a warning on above line. I have such issue with a lot of tasks. I don’t understand loop\_control that well. I tried to provide that variable after register: but still running into issue.

 |
