From ff5b507203f34a009786b2895b1ff182b35e3b7d Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 19 Oct 2017 18:36:39 +0200 Subject: [PATCH] Add a playbook to install the resource registry handlers jar. See https://support.d4science.org/issues/9941 --- .../defaults/main.yml | 8 ++++++ .../resource_registry_handlers/tasks/main.yml | 27 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 smartgears/resource_registry_handlers/defaults/main.yml create mode 100644 smartgears/resource_registry_handlers/tasks/main.yml diff --git a/smartgears/resource_registry_handlers/defaults/main.yml b/smartgears/resource_registry_handlers/defaults/main.yml new file mode 100644 index 00000000..9db8394f --- /dev/null +++ b/smartgears/resource_registry_handlers/defaults/main.yml @@ -0,0 +1,8 @@ +--- +resource_registry_handlers_install: False +resource_registry_handlers_upgrade: False +resource_registry_handlers_version: latest +resource_registry_handlers_name: resource-registry-handlers +resource_registry_handlers_extension: jar +resource_registry_handlers_file: '{{ resource_registry_handlers_name }}-{{ resource_registry_handlers_version }}.{{ resource_registry_handlers_extension }}' +resource_registry_handlers_group_id: org.gcube.smartgears.handlers diff --git a/smartgears/resource_registry_handlers/tasks/main.yml b/smartgears/resource_registry_handlers/tasks/main.yml new file mode 100644 index 00000000..0a33b793 --- /dev/null +++ b/smartgears/resource_registry_handlers/tasks/main.yml @@ -0,0 +1,27 @@ +--- +- block: + - name: Remove the old resource-registry-handlers files + shell: rm -f {{ smartgears_instance_path }}/lib/{{ resource_registry_handlers_name }}-*.{{ resource_registry_handlers_extension }} + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'resource_registry_handlers', 'tomcat' ] + when: not resource_registry_handlers_install + +- block: + - name: Get the resource_registry_handlers jar + maven_artifact: artifact_id={{ resource_registry_handlers_name }} version={{ resource_registry_handlers_version | default('latest') }} group_id={{ resource_registry_handlers_group_id }} extension={{ resource_registry_handlers_extension }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_directory }}/{{ resource_registry_handlers_file }} + register: resource_registry_handlers_download + + - name: Remove the old resource-registry-handlers file + shell: rm -f {{ smartgears_instance_path }}/lib/{{ resource_registry_handlers_name }}-*.{{ resource_registry_handlers_extension }} + when: ( resource_registry_handlers_download | changed ) + + - name: Copy the resource registry jar file into the tomcat lib directory + copy: src={{ smartgears_downloads_dir }}/{{ resource_registry_handlers_file }} dest={{ smartgears_instance_path }}/lib/{{ resource_registry_handlers_file }} remote_src=yes force=yes + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'resource_registry_handlers', 'tomcat' ] + when: resource_registry_handlers_install