From 7ec07427861c521765f2589219d15786e8cbb4f2 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 22 Feb 2017 18:18:43 +0100 Subject: [PATCH] library/roles/smartgears/data-transfer-service: New role that downloads and install the data transfer service. --- .../data-transfer-service/defaults/main.yml | 9 +++++++ .../data-transfer-service/tasks/main.yml | 26 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 smartgears/data-transfer-service/defaults/main.yml create mode 100644 smartgears/data-transfer-service/tasks/main.yml diff --git a/smartgears/data-transfer-service/defaults/main.yml b/smartgears/data-transfer-service/defaults/main.yml new file mode 100644 index 00000000..55b126c4 --- /dev/null +++ b/smartgears/data-transfer-service/defaults/main.yml @@ -0,0 +1,9 @@ +--- +data_transfer_service_install: False +data_transfer_service_version: 1.2.1-4.3.0-141906 +data_transfer_service_name: data-transfer-service +data_transfer_group_id: org.gcube.data.transfer +data_transfer_extension: war +data_transfer_service_file: '{{ data_transfer_service_name }}-{{ data_transfer_service_version }}.{{ data_transfer_extension }}' +data_transfer_service_repository_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}' + diff --git a/smartgears/data-transfer-service/tasks/main.yml b/smartgears/data-transfer-service/tasks/main.yml new file mode 100644 index 00000000..8aa4cf9f --- /dev/null +++ b/smartgears/data-transfer-service/tasks/main.yml @@ -0,0 +1,26 @@ +--- +- block: + - name: Remove the old data transfer files + file: path={{ smartgears_instance_path }}/webapps/{{ data_transfer_service_name }} state=absent + + become: True + become_user: '{{ d4science_user }}' + when: ( not data_transfer_service_install ) or ( smartgears_upgrade ) + tags: [ 'smartgears', 'data_transfer_service', 'tomcat' ] + +- block: + # NOTE: Install as the smartgears user so we do not mess with the permissions + - name: Get the data-transfer-service war + maven_artifact: artifact_id={{ data_transfer_service_name }} version={{ data_transfer_service_version | default(omit) }} group_id={{ data_transfer_group_id }} extension={{ data_transfer_extension | default('war') }} repository_url={{ data_transfer_service_repository_url }} dest={{ smartgears_user_home }}/{{ data_transfer_service_file }} + + - name: Create the data trasfer working directory + file: path={{ smartgears_instance_path }}/webapps/{{ data_transfer_service_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} + + - name: Unarchive the data_transfer_service war + unarchive: copy=no src={{ smartgears_user_home }}/{{ data_transfer_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ data_transfer_service_name }} creates={{ smartgears_instance_path }}/webapps/{{ data_transfer_service_name }}/WEB-INF/lib + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + when: data_transfer_service_install + tags: [ 'smartgears', 'data_transfer_service', 'tomcat' ]