From 0a9e292f64212e081ee98b0401aa49302f2c0517 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 11 Oct 2017 18:14:34 +0200 Subject: [PATCH] quota service: Clean up the role. --- smartgears/quota_service/defaults/main.yml | 1 - smartgears/quota_service/tasks/main.yml | 23 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/smartgears/quota_service/defaults/main.yml b/smartgears/quota_service/defaults/main.yml index d7606891..95908896 100644 --- a/smartgears/quota_service/defaults/main.yml +++ b/smartgears/quota_service/defaults/main.yml @@ -5,5 +5,4 @@ quota_service_name: quota-manager quota_group_id: org.gcube.resource.management quota_extension: war quota_service_file: '{{ quota_service_name }}-{{ quota_service_version }}.{{ quota_extension }}' -quota_service_repository_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}' diff --git a/smartgears/quota_service/tasks/main.yml b/smartgears/quota_service/tasks/main.yml index f425270f..eda14535 100644 --- a/smartgears/quota_service/tasks/main.yml +++ b/smartgears/quota_service/tasks/main.yml @@ -1,23 +1,28 @@ --- - block: - name: Remove the old quota service files - file: path={{ smartgears_instance_path }}/webapps/{{ quota_service_name }} state=absent + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ quota_service_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ quota_service_name }}.{{ quota_service_extension }}' + notify: Restart smartgears become: True become_user: '{{ d4science_user }}' - when: ( not quota_service_install ) or ( smartgears_upgrade ) + when: not quota_service_install tags: [ 'smartgears', 'quota_service', 'tomcat' ] - block: - # NOTE: Install as the smartgears user so we do not mess with the permissions - name: Get the quota-service war - maven_artifact: artifact_id={{ quota_service_name }} version={{ quota_service_version | default(omit) }} group_id={{ quota_group_id }} extension={{ quota_extension | default('war') }} repository_url={{ quota_service_repository_url }} dest={{ smartgears_user_home }}/{{ quota_service_file }} + maven_artifact: artifact_id={{ quota_service_name }} version={{ quota_service_version | default(omit) }} group_id={{ quota_group_id }} extension={{ quota_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ quota_service_file }} + register: quota_service_download - - name: Create the quota manager working directory - file: path={{ smartgears_instance_path }}/webapps/{{ quota_service_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} - - - name: Unarchive the quota_service war - unarchive: copy=no src={{ smartgears_user_home }}/{{ quota_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ quota_service_name }} creates={{ smartgears_instance_path }}/webapps/{{ quota_service_name }}/WEB-INF/lib + - name: Remove the old quota service files + file: path={{ smartgears_instance_path }}/webapps/{{ quota_service_name }} state=absent + when: ( quota_service_download | changed ) + + - name: Copy the quota_service war to the destination place + copy: src={{ smartgears_downloads_dir }}/{{ quota_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ quota_service_name }}.{{ quota_service_extension }} remote_src=yes force=yes notify: Restart smartgears become: True