# loop over roles?

**URL:** <https://forum.ansible.com/t/loop-over-roles/22150>\
**Category:** Ansible Project\
**Created:** [July 28, 2016, 2:05pm UTC](https://forum.ansible.com/t/loop-over-roles/22150 "2016-07-28T14:05:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 28, 2016, 2:05pm UTC](https://forum.ansible.com/t/loop-over-roles/22150/1 "2016-07-28T14:05:07Z")

</div>

Hi

I have a bunch of roles in my playbook:

roles:  
&nbsp;&nbsp;- role\_1  
&nbsp;&nbsp;- role\_b  
&nbsp;&nbsp;- { role: install\_app, install\_dir=/opt/foo }  
&nbsp;&nbsp;- { role: install\_app, install\_dir=/opt/bar }  
&nbsp;&nbsp;- { role: install\_app, install\_dir=/opt/baz }  
&nbsp;&nbsp;- finalrole

Suppose I have a var that contains

apps:  
&nbsp;&nbsp;foo  
&nbsp;&nbsp;bar  
&nbsp;&nbsp;baz

Would it be possible to loop over these in the roles section?

Thanks

Dick

---

<div class="post-metadata">

**Author:** ![Artyom\_Aleksandrov](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@Artyom\_Aleksandrov](https://forum.ansible.com/u/Artyom_Aleksandrov)\
**Post date:** [August 5, 2016, 9:37pm UTC](https://forum.ansible.com/t/loop-over-roles/22150/2 "2016-08-05T21:37:45Z")

</div>

Hi, not it’s not possible.

Same question on github - [https://github.com/ansible/ansible/issues/12623](https://github.com/ansible/ansible/issues/12623)
