From bf9eaa33092ee6723ed63edf27066fd2de83ab26 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 26 Jun 2017 14:43:39 +0200 Subject: [PATCH] library/roles/smartgears/gcubeapp-setup: Fix the case where multiple apps are involved. --- smartgears/gcubeapp-setup/defaults/main.yml | 2 +- smartgears/gcubeapp-setup/tasks/main.yml | 8 +++----- .../gcubeapp-setup/templates/gcube-app.xml.j2 | 18 +++++++++--------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/smartgears/gcubeapp-setup/defaults/main.yml b/smartgears/gcubeapp-setup/defaults/main.yml index c1ed1e70..0e0df775 100644 --- a/smartgears/gcubeapp-setup/defaults/main.yml +++ b/smartgears/gcubeapp-setup/defaults/main.yml @@ -2,6 +2,6 @@ gcubeapp_setup: False #gcubeapp_webapps: -# - { webapp_name: '', version: '', webapp_group: '', description: '', exclude_handlers: [ '' ] } +# - { webapp_path: '', webapp_name: '', version: '', webapp_group: '', description: '', exclude_handlers: [ '' ] } diff --git a/smartgears/gcubeapp-setup/tasks/main.yml b/smartgears/gcubeapp-setup/tasks/main.yml index d1c3a343..a008b25c 100644 --- a/smartgears/gcubeapp-setup/tasks/main.yml +++ b/smartgears/gcubeapp-setup/tasks/main.yml @@ -1,10 +1,8 @@ --- - 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 + template: src=gcube-app.xml.j2 dest={{ item.webapp_path | default('/home/gcube/tomcat') }}/webapps/{{ item.webapp_name }}/WEB-INF/gcube-app.xml owner={{ smartgears_user }} group={{ smartgears_user }} + with_items: '{{ gcubeapp_webapps | default (omit) }}' + notify: Restart smartgears when: gcubeapp_setup tags: [ 'smartgears', 'gcubeapp' ] diff --git a/smartgears/gcubeapp-setup/templates/gcube-app.xml.j2 b/smartgears/gcubeapp-setup/templates/gcube-app.xml.j2 index d51366a0..752875ef 100644 --- a/smartgears/gcubeapp-setup/templates/gcube-app.xml.j2 +++ b/smartgears/gcubeapp-setup/templates/gcube-app.xml.j2 @@ -1,16 +1,16 @@ - {{ item.1.webapp_name }} - {{ item.1.webapp_group }} - {{ item.1.version }} -{% if item.1.description is defined %} - "{{ item.1.description }}" + {{ item.webapp_name }} + {{ item.webapp_group }} + {{ item.version }} +{% if item.description is defined %} + "{{ item.description }}" {% endif %} -{% if item.1.persistence_location is defined %} - +{% if item.persistence_location is defined %} + {% endif %} -{% if item.1.exclude_handlers is defined %} -{% for eh in item.1.exclude_handlers %} +{% if item.exclude_handlers is defined %} +{% for eh in item.exclude_handlers %} {% endfor %} {% endif %}