# Running role multiple times during playbook

**URL:** <https://forum.ansible.com/t/running-role-multiple-times-during-playbook/16786>\
**Category:** Ansible Project\
**Created:** [November 14, 2014, 2:19pm UTC](https://forum.ansible.com/t/running-role-multiple-times-during-playbook/16786 "2014-11-14T14:19:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Helma\_hepabolu](https://avatars.discourse-cdn.com/v4/letter/h/ecccb3/32.png) [@Helma\_hepabolu](https://forum.ansible.com/u/Helma_hepabolu)\
**Post date:** [November 14, 2014, 2:19pm UTC](https://forum.ansible.com/t/running-role-multiple-times-during-playbook/16786/1 "2014-11-14T14:19:01Z")

</div>

Hi,

I need to set up a general test server with multiple java applications. To avoid conflicts we decided to add a separate tomcat installation to each app and configure it separately. The final directory structure should look something like this:

/develop  
/app1  
/conf  
/tomcat  
/app2  
/conf  
/tomcat  
/app3  
/conf  
/tomcat

So I’ve created a playbook with a role for the tomcat installation and one for each app, so:

roles  
/app1  
/app2  
/app3  
/tomcatdev

Each app has a meta/main.yml which contains:

dependencies:

- { role: tomcatdev, tomcatpath: ‘{{ approotdir }}’ }

This works, but only for the first app role that is run. So app1 gets a tomcat installation, but not app2 and app3. When I comment out app1 and rerun the playbook, app2 gets the tomcat installation, but not app3 etc.

How can I make sure that the tomcatdev role is run for every app role?

---

<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:** [November 14, 2014, 8:36pm UTC](https://forum.ansible.com/t/running-role-multiple-times-during-playbook/16786/2 "2014-11-14T20:36:30Z")

</div>

As it shows in the docs:  
[http://docs.ansible.com/playbooks\_roles.html#role-dependencies](http://docs.ansible.com/playbooks_roles.html#role-dependencies)

you need:  
allow\_duplicates: yes

---

<div class="post-metadata">

**Author:** ![Helma\_hepabolu](https://avatars.discourse-cdn.com/v4/letter/h/ecccb3/32.png) [@Helma\_hepabolu](https://forum.ansible.com/u/Helma_hepabolu)\
**Post date:** [November 24, 2014, 12:52pm UTC](https://forum.ansible.com/t/running-role-multiple-times-during-playbook/16786/3 "2014-11-24T12:52:02Z")

</div>

Thanks, didn’t know where to look.
