Running role multiple times during playbook

389 views
Skip to first unread message

Helma hepabolu

unread,
Nov 14, 2014, 9:19:01 AM11/14/14
to ansible...@googlegroups.com
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?


Brian Coca

unread,
Nov 14, 2014, 3:36:35 PM11/14/14
to ansible...@googlegroups.com
As it shows in the docs:
http://docs.ansible.com/playbooks_roles.html#role-dependencies

you need:
allow_duplicates: yes 

--
Brian Coca

Helma hepabolu

unread,
Nov 24, 2014, 7:52:02 AM11/24/14
to ansible...@googlegroups.com
Thanks, didn't know where to look.
Reply all
Reply to author
Forward
0 new messages