From e38cd4c569c9e8e277bb98923c924d6faf9f26cc Mon Sep 17 00:00:00 2001
From: Andrea Dell'Amico <adellam@isti.cnr.it>
Date: Thu, 14 Sep 2017 18:37:52 +0200
Subject: [PATCH] ccounting_insert_storage_se: Manage the app removal.

---
 .../accounting_insert_storage_se_plugin/tasks/main.yml   | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/smartgears/accounting_insert_storage_se_plugin/tasks/main.yml b/smartgears/accounting_insert_storage_se_plugin/tasks/main.yml
index 82259db..076c85f 100644
--- a/smartgears/accounting_insert_storage_se_plugin/tasks/main.yml
+++ b/smartgears/accounting_insert_storage_se_plugin/tasks/main.yml
@@ -1,4 +1,13 @@
 ---
+- block:
+    - name: Remove the old accounting insert storage plugin 
+      shell: rm -f {{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/{{ accounting_insert_storage_se_plugin_maven_artifact_id }}-*-jar-with-dependencies.jar
+    
+  become: True
+  become_user: '{{ smartgears_user }}'
+  when: not accounting_insert_storage_se_plugin_install 
+  tags: [ 'smartgears', 'accounting_insert_storage_se', 'tomcat' ]
+
 - block:
     - name: Get the accounting insert storage plugin and install it inside the smart executor
       maven_artifact: artifact_id={{ accounting_insert_storage_se_plugin_name }} version={{ accounting_insert_storage_se_plugin_version | default(omit) }} group_id={{ accounting_insert_storage_se_plugin_group_id }} extension={{ accounting_insert_storage_se_plugin_extension | default('war') }} repository_url={{ smartgears_global_base_url }} classifier={{ accounting_insert_storage_se_plugin_classifier }} dest={{ smartgears_downloads_dir }}/{{ accounting_insert_storage_se_plugin_file }}