From 4019916c687fb928a930778ba8dae8e7007f831e Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 19 Oct 2017 19:30:58 +0200 Subject: [PATCH] IC proxy: better use of the maven_artifact plugin. --- smartgears/ic_proxy/defaults/main.yml | 1 - smartgears/ic_proxy/tasks/main.yml | 25 ++++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/smartgears/ic_proxy/defaults/main.yml b/smartgears/ic_proxy/defaults/main.yml index fbacd8c..b613d6e 100644 --- a/smartgears/ic_proxy/defaults/main.yml +++ b/smartgears/ic_proxy/defaults/main.yml @@ -6,5 +6,4 @@ ic_proxy_name: icproxy ic_proxy_group_id: org.gcube.information-system ic_proxy_extension: war ic_proxy_file: '{{ ic_proxy_name }}-{{ ic_proxy_version }}.{{ ic_proxy_extension }}' -ic_proxy_repository_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}' diff --git a/smartgears/ic_proxy/tasks/main.yml b/smartgears/ic_proxy/tasks/main.yml index 82f9d24..0c28b65 100644 --- a/smartgears/ic_proxy/tasks/main.yml +++ b/smartgears/ic_proxy/tasks/main.yml @@ -1,26 +1,37 @@ --- - block: - name: Remove the old ic_proxy files - file: path={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }} state=absent + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }}.{{ ic_proxy_extension }}' become: True become_user: '{{ d4science_user }}' - when: ( not ic_proxy_install ) or ( smartgears_upgrade ) + when: not ic_proxy_install tags: [ 'smartgears', 'ic_proxy', 'tomcat' ] - block: - # NOTE: Install as the smartgears user so we do not mess with the permissions - name: Get the ic_proxy war - maven_artifact: artifact_id={{ ic_proxy_name }} version={{ ic_proxy_version | default(omit) }} group_id={{ ic_proxy_group_id }} extension={{ ic_proxy_extension | default('war') }} repository_url={{ ic_proxy_repository_url }} dest={{ smartgears_user_home }}/{{ ic_proxy_file }} + maven_artifact: artifact_id={{ ic_proxy_name }} version={{ ic_proxy_version | default('latest') }} group_id={{ ic_proxy_group_id }} extension={{ ic_proxy_extension }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ ic_proxy_file }} + register: ic_proxy_download + + - name: Remove the old ic_proxy files + file: path={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }} state=absent + when: ( ic_proxy_download | changed ) - name: Create the ic proxy working directory file: path={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} - - name: Unarchive the ic_proxy war - unarchive: copy=no src={{ smartgears_user_home }}/{{ ic_proxy_file }} dest={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }} creates={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }}/WEB-INF/lib + - name: Copy the ic_proxy war into the webapps dir + copy: src={{ smartgears_downloads_dir }}/{{ ic_proxy_file }} dest={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }}.{{ ic_proxy_extension }} remote_src=yes force=yes notify: Restart smartgears - - name: Fix exclude tag in gcube-app.xml + - name: Unarchive the ic_proxy war + unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ ic_proxy_file }} dest={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }} creates={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }}/WEB-INF/lib + notify: Restart smartgears + + - name: Fix the exclude tag in gcube-app.xml template: src=gcube-app.xml.j2 dest={{ smartgears_instance_path }}/webapps/{{ ic_proxy_name }}/WEB-INF/gcube-app.xml owner={{ d4science_user }} group={{ d4science_user }} notify: Restart smartgears when: ic_proxy_allscopes