# I want to make a specific loop but don't know the way how to do it

**URL:** <https://forum.ansible.com/t/i-want-to-make-a-specific-loop-but-dont-know-the-way-how-to-do-it/28162>\
**Category:** Ansible Project\
**Created:** [July 26, 2018, 2:39pm UTC](https://forum.ansible.com/t/i-want-to-make-a-specific-loop-but-dont-know-the-way-how-to-do-it/28162 "2018-07-26T14:39:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@Julien](https://forum.ansible.com/u/Julien)\
**Post date:** [July 26, 2018, 2:39pm UTC](https://forum.ansible.com/t/i-want-to-make-a-specific-loop-but-dont-know-the-way-how-to-do-it/28162/1 "2018-07-26T14:39:37Z")

</div>

Hi,

Today i’m writting a play and i want to do a specific loop but i dont know to do it, here is the explanation:

I’ve created a survey on Tower that is defining the **{{ tma\_name }}** var, this var should have one, or multiple entries like **the default answer**

 ![](https://us1.discourse-cdn.com/ansible/original/2X/9/9454f8b877edefe9ea293a9a0f39093a47b0ea92.png)

After this i’ve created this play:

**- name: Creating User Roles groups (1)**  
**win\_domain\_group:**  
**name: GRP-{{ quadri\_name }}-{{ tma\_name }}-GLS**  
**organizational\_unit: “{{ user\_roles\_ou }}”**  
**domain\_server: “{{ hds\_entity }}”**  
**scope: domainlocal**  
**state: absent**

The thing i want to do is if there is multiple data in the **{{ tma\_name }}** var, it will replay the module with all **{{ tma\_name }}** vars like a simple **[with\_items: - this - is - an - example]**  
I don’t know the way of to do this, (maybe my survey type is bad?)

Thank you  
Best Regards  
Julien.

---

<div class="post-metadata">

**Author:** ![Patrick\_Hunt](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@Patrick\_Hunt](https://forum.ansible.com/u/Patrick_Hunt)\
**Post date:** [July 30, 2018, 4:58pm UTC](https://forum.ansible.com/t/i-want-to-make-a-specific-loop-but-dont-know-the-way-how-to-do-it/28162/2 "2018-07-30T16:58:00Z")

</div>

> If I am understanding correctly it seems as if you could use a loop. Something like:

- name: creating user roles groups (1)  
win\_domain\_group:  
name: GRP-{{ quadri\_name }}- {{ item }}-GLS  
organizationl\_unit: “{{ user\_roles\_ou }}”  
domain\_server: “{{ hds\_entity }}”  
scope: domainlocal  
state: absent  
loop: “{{ tma\_name }}”

---

<div class="post-metadata">

**Author:** ![Julien](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@Julien](https://forum.ansible.com/u/Julien)\
**Post date:** [July 31, 2018, 8:52am UTC](https://forum.ansible.com/t/i-want-to-make-a-specific-loop-but-dont-know-the-way-how-to-do-it/28162/3 "2018-07-31T08:52:09Z")

</div>

Hello Patrick, thanks for replying

I’ve forgot some information in my post

{{ tma\_name }} have multiple data and {{ hds\_entity }} too. The thing that i want to do is for each {{ hds\_entity }}, check all {{ tma\_name }}

Here is the scheme:

entity1 =\> tma1, tma2, tma3  
entity2 =\> tma1, tma2, tma3  
entity3 =\> tma1, tma2, tma3

This is the loop that i want to do,

Sorry for this mistake

Best Regards,  
Julien

, Le lundi 30 juillet 2018 18:58:00 UTC+2, Patrick Hunt a écrit :

---

<div class="post-metadata">

**Author:** ![Julien](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@Julien](https://forum.ansible.com/u/Julien)\
**Post date:** [July 31, 2018, 8:54am UTC](https://forum.ansible.com/t/i-want-to-make-a-specific-loop-but-dont-know-the-way-how-to-do-it/28162/4 "2018-07-31T08:54:02Z")

</div>

And I have one other question,

What kind of variable do the survey type “textarea” return? List ? Dictionnary?

Julien

---

<div class="post-metadata">

**Author:** ![Julien](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@Julien](https://forum.ansible.com/u/Julien)\
**Post date:** [August 3, 2018, 9:26am UTC](https://forum.ansible.com/t/i-want-to-make-a-specific-loop-but-dont-know-the-way-how-to-do-it/28162/5 "2018-08-03T09:26:26Z")

</div>

I always need a solution 🙂 up

---

<div class="post-metadata">

**Author:** ![Julien](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@Julien](https://forum.ansible.com/u/Julien)\
**Post date:** [March 13, 2019, 2:07pm UTC](https://forum.ansible.com/t/i-want-to-make-a-specific-loop-but-dont-know-the-way-how-to-do-it/28162/6 "2019-03-13T14:07:01Z")

</div>

Hey,

The solution is to use with\_nested instead of with\_items

Bye 🙂
