From 137af07a9060b8b14b4a3e41ef3cf6e52674f15d Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 11 Oct 2017 17:20:04 +0200 Subject: [PATCH] Convert the generic worker to maven_artifact. --- smartgears/generic_worker/defaults/main.yml | 11 +++++--- smartgears/generic_worker/tasks/main.yml | 29 ++++++++++++++++++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/smartgears/generic_worker/defaults/main.yml b/smartgears/generic_worker/defaults/main.yml index 11952b74..d4d70eea 100644 --- a/smartgears/generic_worker/defaults/main.yml +++ b/smartgears/generic_worker/defaults/main.yml @@ -1,7 +1,12 @@ --- generic_worker_install: False -smart_generic_worker_plugin_ver: 1.0.3-4.0.0-128830 -smart_generic_worker_plugin_name: 'smart-generic-worker-{{ smart_generic_worker_plugin_ver }}-jar-with-dependencies.jar' -smart_generic_worker_plugin_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}/org/gcube/dataanalysis/smart-generic-worker/{{ smart_generic_worker_plugin_ver }}/{{ smart_generic_worker_plugin_name }}' +smart_generic_worker_plugin_name: 'smart-generic-worker' + +smart_generic_worker_plugin_group_id : 'org.gcube.dataanalysis' +smart_generic_worker_plugin_artifact_id : '{{ smart_generic_worker_plugin_name }}' +smart_generic_worker_plugin_version : latest +smart_generic_worker_plugin_extension: jar +smart_generic_worker_plugin_classifier: jar-with-dependencies +smart_generic_worker_plugin_file: '{{ smart_generic_worker_plugin_name }}-{{ smart_generic_worker_plugin_version }}-jar-with-dependencies.{{ smart_generic_worker_plugin_extension }}' diff --git a/smartgears/generic_worker/tasks/main.yml b/smartgears/generic_worker/tasks/main.yml index 8010717b..e391cb5f 100644 --- a/smartgears/generic_worker/tasks/main.yml +++ b/smartgears/generic_worker/tasks/main.yml @@ -1,9 +1,30 @@ --- -- name: Get the smart generic worker plugin and install it inside the smart executor +- block: + - name: Remove the smart generic worker plugin + shell: rm -f {{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/{{ smart_generic_worker_plugin_name }}-*-jar-with-dependencies.jar + notify: Restart smartgears + become: True become_user: '{{ smartgears_user }}' - get_url: url={{ smart_generic_worker_plugin_url }} dest={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib - when: generic_worker_install - notify: Restart smartgears + when: not generic_worker_install tags: [ 'smartgears', 'generic_worker', 'tomcat' ] +- block: + - name: Get the smart generic worker plugin and install it inside the smart executor + maven_artifact: artifact_id={{ smart_generic_worker_plugin_name }} version={{ smart_generic_worker_plugin_version | default('latest') }} group_id={{ smart_generic_worker_plugin_group_id }} extension={{ smart_generic_worker_plugin_extension | default('war') }} repository_url={{ smartgears_global_base_url }} classifier={{ smart_generic_worker_plugin_classifier }} dest={{ smartgears_downloads_dir }}/{{ smart_generic_worker_plugin_file }} + register: smart_executor_download + + - name: Remove the old accounting aggregator plugin + shell: rm -f {{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/{{ smart_generic_worker_plugin_name }}-*-jar-with-dependencies.jar + when: (smart_executor_download | changed) + + - name: Copy the accounting aggregator plugin to its final destination + copy: src={{ smartgears_downloads_dir }}/{{ smart_generic_worker_plugin_file }} dest={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/{{ smart_generic_worker_plugin_file }} remote_src=yes force=yes + notify: Restart smartgears + + become: True + become_user: '{{ smartgears_user }}' + when: generic_worker_install + tags: [ 'smartgears', 'generic_worker', 'tomcat' ] + +