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

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

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.

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 }}”

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 :

And I have one other question,

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

Julien

I always need a solution :slight_smile: up

Hey,

The solution is to use with_nested instead of with_items

Bye :slight_smile: