ansible-roles/smartgears/dataminer_app/tasks/dataminer-app.yml

125 lines
7.2 KiB
YAML
Raw Normal View History

---
# This is only needed to force an upgrade
- 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' ]
# This is only needed to force an upgrade
- 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_downloads_dir }}/{{ dataminer_wps_file }}
register: dataminer_app_downloaded
- name: Remove the old dataminer installation
file: path={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }} state=absent
when: (dataminer_app_downloaded | changed)
- name: Create the dataminer wps working directory
file: path={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }}
- name: Unarchive the dataminer_wps war
unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ dataminer_wps_file }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }} creates='{{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }}/WEB-INF/lib'
notify: Restart smartgears
- name: Install the dataminer web.xml
template: src=web.xml.j2 dest={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }}/WEB-INF/lib/web.xml
notify: Restart smartgears
- name: Create a directory where to install the algorithms directory
file: path={{ smartgears_user_home }}/wps_algorithms state=directory
- 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_downloads_dir }}/{{ 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
unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ dataminer_algorithms_file }} dest={{ smartgears_user_home }} creates='{{ smartgears_user_home }}/algorithmInstaller/addAlgorithm.sh'
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ]
- name: Download the WPS algorithms from subversion
subversion: repo={{ dataminer_wps_algorithms_svn }} dest={{ smartgears_user_home }}/wps_algorithms/algorithms checkout=yes force=yes update=yes
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_svn' ]
- name: Create a directory where to install the algorithms updater logs and data
file: path={{ smartgears_user_home }}/wps_algorithms_install_log state=directory
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_script' ]
- name: Install a script that updates the algorithms repository and adds the missing algorithms configurations
become_user: "{{ d4science_ansible_become_user | default('root') }}"
template: src=algorithms-updater.j2 dest=/usr/local/bin/algorithms-updater mode=0755
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_script' ]
- name: Cron job that updates the algorithms repository and adds the missing algorithms configurations
cron: name="SVN update the algorithms repository" minute="{{ dataminer_algorithms_updater_minute_frequency }}" hour="{{ dataminer_algorithms_updater_hour_frequency }}" job="/usr/local/bin/algorithms-updater > {{ smartgears_user_home }}/wps_algorithms_install_log/algorithms_updater_cron.log 2>&1" user='{{ smartgears_user }}' state={{ dataminer_algorithms_updater_cron }}
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_cron' ]
- 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_user_home }}/data/gebco_08.nc timeout=2400
- 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_wps_name }}/ecocfg/gebco_08.nc state=link
notify: Restart smartgears
- name: Install a couple of jar files under ecocfg
get_url: url=http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/wps/src/main/webapp/ecocfg/{{ item }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }}/ecocfg/{{ item }}
with_items:
- 'YASMEEN-matcher-1.2.0.1.jar'
- 'YASMEEN-parser-1.2.0.jar'
- name: Install a couple of jar files under ecocfg/PARALLEL_PROCESSING
get_url: url=http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/wps/src/main/webapp/ecocfg/{{ item }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }}/ecocfg/PARALLEL_PROCESSING/{{ item }}
with_items:
- 'YASMEEN-matcher-1.2.0.1.jar'
- 'YASMEEN-parser-1.2.0.jar'
- name: Install the old properties files
copy: src={{ item }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }}/ecocfg/{{ item }} force=yes
with_items: '{{ dataminer_properties_files }}'
- name: Install the script that fixes the WPS configuration
become_user: "{{ d4science_ansible_become_user | default('root') }}"
template: src=wps-config-fixer.j2 dest=/usr/local/bin/wps-config-fixer owner=root group=root mode=0555
with_items: '{{ tomcat_m_instances }}'
- name: Install the catalina additional configuration
template: src={{ dataminer_wps_name }}.xml.j2 dest={{ item.instance_path }}/conf/Catalina/localhost/{{ dataminer_wps_name }}.xml
with_items: '{{ tomcat_m_instances }}'
notify: Restart smartgears
- name: Fix the WPS config file
shell: /usr/local/bin/wps-config-fixer
# notify: Restart smartgears
become: True
become_user: '{{ smartgears_user }}'
when: dataminer_app_install
tags: [ 'tomcat', 'dataminer', 'wps' ]