---
- name: Install the gcube-app file to make the webapp smartgears compatible
  template: src=gcube-app.xml.j2 dest={{ item.0.instance_path }}/webapps/{{ item.1.webapp_name }}/WEB-INF/gcube-app.xml owner={{ item.0.user }} group={{ item.0.user }}
  with_together:
        - '{{ tomcat_m_instances }}'
        - '{{ gcubeapp_webapps | default (omit) }}'
  notify: tomcat instances restart 
  when: gcubeapp_setup
  tags: [ 'smartgears', 'gcubeapp' ]