Running role multiple times during playbook

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?

As it shows in the docs:
http://docs.ansible.com/playbooks_roles.html#role-dependencies

you need:
allow_duplicates: yes

Thanks, didn’t know where to look.