# Looping over 3 set of values and using each combination

**URL:** <https://forum.ansible.com/t/looping-over-3-set-of-values-and-using-each-combination/17575>\
**Category:** Ansible Developer\
**Created:** [February 20, 2015, 1:28pm UTC](https://forum.ansible.com/t/looping-over-3-set-of-values-and-using-each-combination/17575 "2015-02-20T13:28:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Gottschkes](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Sebastian\_Gottschkes](https://forum.ansible.com/u/Sebastian_Gottschkes)\
**Post date:** [February 20, 2015, 1:28pm UTC](https://forum.ansible.com/t/looping-over-3-set-of-values-and-using-each-combination/17575/1 "2015-02-20T13:28:09Z")

</div>

Hi,

sorry for the title, it’s hard to describe in a short sentence.

I need to use the acl module on all combination of 3 entities, 2 etypes and 2 names (dirs).  
Here is what I am doing right now (take a look at task “set user acl for cache”): [https://github.com/agileaddicts/ansible-playbooks/blob/6faf3e78122b1b1d1cc1f4d66441ffbecce79e8a/roles/cllctr/tasks/main.yml](https://github.com/agileaddicts/ansible-playbooks/blob/6faf3e78122b1b1d1cc1f4d66441ffbecce79e8a/roles/cllctr/tasks/main.yml)

I tried using loop\_together but it serves another use-case. I didn’t find any other lookup\_plugin that would serve my use case. Is this something which should be solved the way I do or is there another, nicer way?

Thanks for your help.

Take care,  
Sebastian

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 20, 2015, 2:05pm UTC](https://forum.ansible.com/t/looping-over-3-set-of-values-and-using-each-combination/17575/2 "2015-02-20T14:05:42Z")

</div>

You wan the cartesian product, which did not exist until now:

[https://github.com/ansible/ansible/pull/10305](https://github.com/ansible/ansible/pull/10305)

---

<div class="post-metadata">

**Author:** ![Sebastian\_Gottschkes](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Sebastian\_Gottschkes](https://forum.ansible.com/u/Sebastian_Gottschkes)\
**Post date:** [February 20, 2015, 2:17pm UTC](https://forum.ansible.com/t/looping-over-3-set-of-values-and-using-each-combination/17575/3 "2015-02-20T14:17:54Z")

</div>

Hi Brian,

awesome! I just checked out your branch locally and I am testing 🙂

Sebastian
