diff --git a/smartgears/smartgears/tasks/smartgears-app.yml b/smartgears/smartgears/tasks/smartgears-app.yml
index 3c6349e1..e3839dd7 100644
--- a/smartgears/smartgears/tasks/smartgears-app.yml
+++ b/smartgears/smartgears/tasks/smartgears-app.yml
@@ -9,18 +9,6 @@
creates: '{{ smartgears_user_home }}/.smartgears_distribution_cleaned'
tags: [ 'smartgears', 'tomcat' ]
-- name: Remove the smartgears distribution archive to force un upgrade
- file: dest={{ item }} state=absent
- with_items:
- - '{{ smartgears_downloads_dir }}/{{ smartgears_file }}'
- - '{{ smartgears_user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}'
- when: smartgears_force_install
- tags: [ 'smartgears', 'tomcat' ]
-
-- name: Remove the smartgears-distribution files
- shell: rm -fr {{ smartgears_downloads_dir }}/smartgears-distribution-*
- tags: [ 'smartgears', 'tomcat' ]
-
- name: Get the smartgears distribution
become: True
become_user: '{{ smartgears_user }}'
@@ -30,6 +18,11 @@
when: not item.skip_smartgears
tags: [ 'smartgears', 'tomcat' ]
+- name: Remove the smartgears-distribution files
+ shell: find . -type d -name {{ smartgears_downloads_dir }}/smartgears-distribution-\* -exec rm -fr {} \;
+ when: ( smartgears_download | changed )
+ tags: [ 'smartgears', 'tomcat' ]
+
- name: Unarchive the smartgears distribution
become: True
become_user: '{{ smartgears_user }}'
@@ -65,8 +58,7 @@
- name: Install the smartgears app
become: True
become_user: '{{ smartgears_user }}'
- #shell: cd {{ smartgears_downloads_dir }}/smartgears-distribution-* ; . /{{ item.user_home }}/.bashrc ; ./install -s tomcat ; chown -R gcube:gcube '{{ item.user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}' '{{ item.user_home }}/SmartGears/' '{{ item.user_home }}/tomcat/lib/' '{{ item.user_home }}/tomcat/webapps/'
- shell: cd {{ smartgears_downloads_dir }}/smartgears-distribution-* ; . /{{ item.user_home }}/.bashrc ; ./install -s tomcat'
+ shell: cd {{ smartgears_downloads_dir }}/smartgears-distribution-* ; . /{{ item.user_home }}/.bashrc ; ./install -s tomcat
with_items: '{{ tomcat_m_instances }}'
when:
- ( smartgears_download | changed )
@@ -75,6 +67,15 @@
notify: Restart smartgears
tags: [ 'smartgears', 'tomcat' ]
+- name: Get the real smartgears version from the exploded distribution filename
+ shell: /bin/ls -1 {{ smartgears_downloads_dir }} | grep smartgears-distribution | grep -v tar.gz | sed -e 's/smartgears-distribution-//g'
+ register: smartgears_real_version
+ tags: [ 'smartgears', 'tomcat' ]
+
+- name: Set the real smartgears distribution version
+ set_fact: smartgears_real_distribution_version="{{ smartgears_real_version.stdout }}"
+ tags: [ 'smartgears', 'tomcat' ]
+
- name: Create the directory where we put the smartgears configuration snippets
become: True
become_user: '{{ smartgears_user }}'
diff --git a/smartgears/smartgears/templates/container.xml.j2 b/smartgears/smartgears/templates/container.xml.j2
index f5dc8786..d57898c4 100644
--- a/smartgears/smartgears/templates/container.xml.j2
+++ b/smartgears/smartgears/templates/container.xml.j2
@@ -26,7 +26,11 @@
{{ smartgears_authorized_on_all_scopes }}
+{% if smartgears_distribution_version == 'latest' %}
+
+{% else %}
+{% endif %}
{{ smartgears_publication_frequency }}
{{ smartgears_infrastructure_name }}