Change the dataminer roles again so that the algorithms are always installed but the script that adds them is optiona.

This commit is contained in:
Andrea Dell'Amico 2018-04-07 18:32:12 +02:00
parent 1f2a02a727
commit 5a4d729503
3 changed files with 44 additions and 35 deletions

View File

@ -1,5 +1,23 @@
---
# This is only needed to force an upgrade of the algorithm importer script
- block:
- name: Install the subversion packages
become_user: root
apt: pkg=subversion state=present update_cache=yes cache_valid_time=1800
- name: Create a directory where to install the algorithms directory
file: path={{ smartgears_user_home }}/wps_algorithms/algorithms state=directory
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_svn' ]
- name: Download the WPS algorithms from subversion
subversion: repo={{ dataminer_wps_algorithms_svn }} dest={{ smartgears_user_home }}/wps_algorithms/algorithms/{{ dataminer_infra_reference }} checkout=yes force=yes update=yes
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_svn' ]
become: True
become_user: '{{ smartgears_user }}'
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ]
# This is only needed to force an upgrade of the algorithm importer script and libraries
- block:
- name: Remove the old dataminer algorithm installer to force an upgrade
file: path={{ smartgears_user_home }}/algorithmInstaller state=absent
@ -10,33 +28,12 @@
become: True
become_user: '{{ smartgears_user }}'
when:
- dataminer_app_install
- dataminer_algorithms_installer
- dataminer_algorithms_upgrade
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ]
- block:
- name: Verify if we have the old algorithms setup
stat: path={{ smartgears_user_home }}/wps_algorithms/algorithms/AAPS_NASO_PUBLISHER.jar
register: old_algo_setup
- name: Wipe away the algoriths directory if it comes from the old setup
file: dest={{ smartgears_user_home }}/wps_algorithms state=absent
when: old_algo_setup.stat.exists
- name: Create a directory where to install the algorithms directory
file: path={{ smartgears_user_home }}/wps_algorithms/algorithms state=directory
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_svn' ]
- name: Install the subversion packages
become_user: root
apt: pkg=subversion state=present update_cache=yes cache_valid_time=1800
- name: Download the WPS algorithms from subversion
subversion: repo={{ dataminer_wps_algorithms_svn }} dest={{ smartgears_user_home }}/wps_algorithms/algorithms/{{ dataminer_infra_reference }} checkout=yes force=yes update=yes
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_svn' ]
- name: Get the algorithms installer via maven_artifact
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
@ -49,6 +46,7 @@
- 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'
notify: Restart smartgears
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ]
- name: Create a directory where to install the algorithms updater logs and data
@ -60,18 +58,23 @@
template: src=algorithms-updater.j2 dest=/usr/local/bin/algorithms-updater mode=0755
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_script' ]
- name: Remove the list of the installed algorithms if we are upgrading from the old algorithms setup
file: dest={{ smartgears_user_home }}/wps_algorithms_install_log/already_installed_algorithms.txt state=absent
when: old_algo_setup.stat.exists
- 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' ]
become: True
become_user: '{{ smartgears_user }}'
when:
- dataminer_app_install
- dataminer_algorithms_upgrade
when: dataminer_algorithms_installer
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ]
- block:
- name: Remove the 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 }} state=absent
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_cron' ]
become: True
become_user: '{{ smartgears_user }}'
when: not dataminer_algorithms_installer
tags: [ 'tomcat', 'dataminer', 'wps', 'dataminer_algorithms', 'dataminer_algorithms_installer' ]

View File

@ -35,13 +35,20 @@
- name: Remove the file that lists the installed algorithms, after an upgrade
file: dest={{ smartgears_user_home }}/wps_algorithms_install_log/already_installed_algorithms.txt state=absent
register: reinstall_algorithms
when: dataminer_updated is changed
- name: After an update, reinstall the algorithms
shell: /usr/local/bin/algorithms-updater &
when:
- reinstall_algorithms is changed
- dataminer_algorithms_installer
become: True
become_user: '{{ smartgears_user }}'
when: dataminer_app_install
tags: [ 'tomcat', 'dataminer', 'wps' ]
- block:
- name: Install the nscd service to work around dns timeouts
@ -56,10 +63,9 @@
when: dataminer_install_nscd is defined and dataminer_install_nscd
tags: [ 'tomcat', 'dataminer', 'wps', 'dm_nscd' ]
become: True
become_user: '{{ smartgears_user }}'
when:
when:
- dataminer_app_install
- dataminer_install_nscd
tags: [ 'tomcat', 'dataminer', 'wps' ]

View File

@ -7,4 +7,4 @@
when: dataminer_app_install
- import_tasks: install-gcube-key.yml
- import_tasks: dataminer-algorithms-installer.yml
when: dataminer_algorithms_installer
when: dataminer_app_install