From d1597d17842de4066464c80c53cbe8423c75fbf4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 13 Sep 2017 16:33:16 +0200 Subject: [PATCH] dataminer: Remove the old algorithms installer when a new distribution has been downloaded from maven. --- smartgears/dataminer_app/defaults/main.yml | 1 + .../dataminer_app/tasks/dataminer-app.yml | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/smartgears/dataminer_app/defaults/main.yml b/smartgears/dataminer_app/defaults/main.yml index 2447ab21..62e27c35 100644 --- a/smartgears/dataminer_app/defaults/main.yml +++ b/smartgears/dataminer_app/defaults/main.yml @@ -15,6 +15,7 @@ dataminer_wps_extension: war dataminer_wps_file: '{{ dataminer_wps_name }}-{{ dataminer_wps_version }}.{{ dataminer_wps_extension }}' # Algorithms installer +dataminer_algorithms_upgrade: False dataminer_algorithms_version: latest dataminer_algorithms_gcube_repository: gcube-snapshots dataminer_algorithms_name: dataminer-algorithms-importer diff --git a/smartgears/dataminer_app/tasks/dataminer-app.yml b/smartgears/dataminer_app/tasks/dataminer-app.yml index 2225b12d..aca1d945 100644 --- a/smartgears/dataminer_app/tasks/dataminer-app.yml +++ b/smartgears/dataminer_app/tasks/dataminer-app.yml @@ -1,4 +1,27 @@ --- +- block: + - name: Remove the old dataminer installation + file: path={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }} state=absent + + become: True + become_user: '{{ smartgears_user }}' + when: + - dataminer_app_install + - dataminer_app_upgrade + tags: [ 'tomcat', 'dataminer', 'wps' ] + + +- block: + - name: Remove the old dataminer algorithm installer + file: path={{ smartgears_user_home }}/algorithmInstaller state=absent + + become: True + become_user: '{{ smartgears_user }}' + when: + - dataminer_app_install + - dataminer_algorithms_upgrade + tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ] + - block: - name: Get and unpack the dataminer application maven_artifact: artifact_id={{ dataminer_wps_name }} version={{ dataminer_wps_version | default(omit) }} group_id={{ dataminer_wps_group_id }} extension={{ dataminer_wps_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_user_home }}/{{ dataminer_wps_file }} @@ -19,6 +42,12 @@ - name: Get and unpack the algorithms installer maven_artifact: artifact_id={{ dataminer_algorithms_name }} version={{ dataminer_algorithms_version | default(omit) }} group_id={{ dataminer_algorithms_group_id }} extension={{ dataminer_algorithms_extension | default('war') }} repository_url={{ dataminer_algorithms_base_url }} dest={{ smartgears_user_home }}/{{ dataminer_algorithms_file }} + register: algorithms_installer_downloaded + tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ] + + - name: Remove the old dataminer algorithm installer + file: path={{ smartgears_user_home }}/algorithmInstaller state=absent + when: (algorithms_installer_downloaded | changed) tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ] - name: Unarchive the algorithms installer