From bfd5ea4d4d4a82d354cff298c14e6dabbb65998f Mon Sep 17 00:00:00 2001
From: Andrea Dell'Amico <adellam@isti.cnr.it>
Date: Wed, 5 Oct 2016 13:31:10 +0200
Subject: [PATCH] library/roles/smartgears/dataminer_app: Install the
 gebco_08.nc file on a place external to the application files and create a
 symlink to it. Remove the now unused tasks that installed The wps original
 war file.

---
 .../dataminer_app/tasks/dataminer-app.yml     |  8 ++-
 smartgears/dataminer_app/tasks/w52n-app.yml   | 61 -------------------
 2 files changed, 7 insertions(+), 62 deletions(-)
 delete mode 100644 smartgears/dataminer_app/tasks/w52n-app.yml

diff --git a/smartgears/dataminer_app/tasks/dataminer-app.yml b/smartgears/dataminer_app/tasks/dataminer-app.yml
index ecfde329..0a047ce7 100644
--- a/smartgears/dataminer_app/tasks/dataminer-app.yml
+++ b/smartgears/dataminer_app/tasks/dataminer-app.yml
@@ -4,8 +4,14 @@
       unarchive: src={{ dataminer_zip_url }} dest={{ smartgears_instance_path }}/webapps copy=no
       notify: Restart smartgears
 
+    - name: Create a directory where to install the gebco_08.nc data file
+      file: path={{ smartgears_user_home }}/data state=directory
+
     - name: Install the gebco_08.nc file from thredds. It is big, mostly 2GB
-      get_url: url={{ dataminer_data_file_from_thredds }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/gebco_08.nc
+      get_url: url={{ dataminer_data_file_from_thredds }} dest={{ smartgears_user_home }}/data/gebco_08.nc
+
+    - name: Create a symlink to the gebco_08.nc file
+      file: src={{ smartgears_user_home }}/data/gebco_08.nc dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/gebco_08.nc state=link
       notify: Restart smartgears
   
     - name: Install the script that fixes the WPS configuration
diff --git a/smartgears/dataminer_app/tasks/w52n-app.yml b/smartgears/dataminer_app/tasks/w52n-app.yml
deleted file mode 100644
index 16f668e3..00000000
--- a/smartgears/dataminer_app/tasks/w52n-app.yml
+++ /dev/null
@@ -1,61 +0,0 @@
----
-# NOTE: Install as the smartgears user so we do not mess with the permissions
-- name: Get the 52 north application war file
-  remote_user: root
-  become: True
-  become_user: '{{ smartgears_user }}'
-  get_url: url={{ dataminer_52north_webapp_url }} dest={{ smartgears_user_home }}/{{ dataminer_52north_webapp_file }}
-  when: dataminer_app_install
-  tags: [ 'tomcat', 'dataminer', 'wps' ]
-  
-- name: Create the 52 north webapp directory and subdirectories
-  remote_user: root
-  become: True
-  become_user: '{{ smartgears_user }}'
-  file: dest={{ smartgears_instance_path }}/webapps/{{ item }} state=directory mode=0755
-  with_items:
-    - '{{ dataminer_52north_webapp_name }}'
-    - '{{ dataminer_52north_webapp_name }}/persistence'
-#    - '{{ dataminer_52north_webapp_name }}/ecocfg'
-  when: dataminer_app_install
-  tags: [ 'tomcat', 'dataminer', 'wps' ]
-
-- name: Unarchive the 52 north webapp distribution
-  remote_user: root
-  become: True
-  become_user: '{{ smartgears_user }}'
-  unarchive: copy=no src={{ smartgears_user_home }}/{{ dataminer_52north_webapp_file }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}
-  args:
-    creates: '{{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/WEB-INF/classes/52N_license.txt'
-  register: install_52_north
-  notify: Restart smartgears
-  when: dataminer_app_install
-  tags: [ 'tomcat', 'dataminer', 'wps' ]
-
-- name: Remove the original web.xml file
-  remote_user: root
-  become: True
-  become_user: '{{ smartgears_user }}'
-  file: dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/WEB-INF/web.xml state=absent
-  notify: Restart smartgears
-  when: ( install_52_north | changed )
-  tags: [ 'tomcat', 'dataminer', 'wps' ]
-
-# Transform the 52n-wps app in a gcube enabled app
-- name: Download the gcube web.xml config file
-  remote_user: root
-  become: True
-  become_user: '{{ smartgears_user }}'
-  get_url: url={{ dataminer_gcube_web_xml }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/WEB-INF/web.xml
-  notify: Restart smartgears
-  when: dataminer_app_install
-  tags: [ 'tomcat', 'dataminer', 'wps' ]
-
-- name: Download the gcube gcube-app.xml config file
-  remote_user: root
-  become: True
-  become_user: '{{ smartgears_user }}'
-  get_url: url={{ dataminer_gcube_app_xml }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/WEB-INF/gcube-app.xml
-  notify: Restart smartgears
-  when: dataminer_app_install
-  tags: [ 'tomcat', 'dataminer', 'wps' ]