From b9e52a6ab5f6685592e7a45c4f06ee2fa6e54c1c Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 28 Feb 2017 15:20:57 +0100 Subject: [PATCH] library/roles/smartgears/tabular_data: Fix the task that manages the tabulardata upgrade. d4science-ghn-cluster/smartgears-node-upgrade.yml: Add tabulardata_upgrade: True to the variables list. --- smartgears/tabular_data/defaults/main.yml | 3 ++- smartgears/tabular_data/tasks/main.yml | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/smartgears/tabular_data/defaults/main.yml b/smartgears/tabular_data/defaults/main.yml index ac68498..c124f7b 100644 --- a/smartgears/tabular_data/defaults/main.yml +++ b/smartgears/tabular_data/defaults/main.yml @@ -1,10 +1,11 @@ --- gcube_repository: gcube-staging tabular_data_install: False +tabular_data_upgrade: False tabular_data_version: latest tabular_data_name: tabular-data-manager -tabular_group_id: org.gcube.resource.management +tabular_group_id: org.gcube.data.analysis.tabulardata tabular_extension: war tabular_data_file: '{{ tabular_data_name }}-{{ tabular_data_version }}.{{ tabular_extension }}' tabular_service_repository_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}' diff --git a/smartgears/tabular_data/tasks/main.yml b/smartgears/tabular_data/tasks/main.yml index a56c15f..b301c66 100644 --- a/smartgears/tabular_data/tasks/main.yml +++ b/smartgears/tabular_data/tasks/main.yml @@ -1,25 +1,30 @@ --- - block: - - name: Remove the old tabulardata files file: path={{ smartgears_instance_path }}/webapps/{{ tabular_data_name }} state=absent - when: ( tabular_data_install ) or ( smartgears_upgrade ) + when: tabular_data_upgrade - # NOTE: Install as the smartgears user so we do not mess with the permissions - name: Get the tabular-data-service maven_artifact: artifact_id={{ tabular_data_name }} version={{ tabular_data_version | default(omit) }} group_id={{ tabular_group_id }} extension={{ tabular_extension | default('war') }} repository_url={{ tabular_service_repository_url }} dest={{ smartgears_user_home }}/{{ tabular_data_file }} - when: tabular_data_install - name: Create the tabular data working directory file: path={{ smartgears_instance_path }}/webapps/{{ tabular_data_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} - when: tabular_data_install - name: Unarchive the tabular data war unarchive: copy=no src={{ smartgears_user_home }}/{{ tabular_data_file }} dest={{ smartgears_instance_path }}/webapps/{{ tabular_data_name }} creates={{ smartgears_instance_path }}/webapps/{{ tabular_data_name }}/WEB-INF/lib - when: tabular_data_install notify: Restart smartgears become: True become_user: '{{ d4science_user }}' + when: tabular_data_install + tags: [ 'smartgears', 'tabular_data', 'tomcat' ] + +- block: + - name: Remove the old tabulardata files + file: path={{ smartgears_instance_path }}/webapps/{{ tabular_data_name }} state=absent + + become: True + become_user: '{{ d4science_user }}' + when: not tabular_data_install tags: [ 'smartgears', 'tabular_data', 'tomcat' ]