From 44e66626cf243a361926decc25ea362688d71440 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 23 Jun 2017 13:39:30 +0200 Subject: [PATCH] library/roles/smartgears/home_library: Convert to maven_artifact. --- smartgears/home_library/defaults/main.yml | 13 ++++---- smartgears/home_library/tasks/main.yml | 39 ++++++++++++++++------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/smartgears/home_library/defaults/main.yml b/smartgears/home_library/defaults/main.yml index 5e25055d..ac7e4e42 100644 --- a/smartgears/home_library/defaults/main.yml +++ b/smartgears/home_library/defaults/main.yml @@ -1,8 +1,9 @@ --- -home_library_gcube_repository: 'gcube-staging' home_library_install: False -home_library_ver: 1.7.0-4.3.0-144852 -home_library_name: home-library-webapp -home_library_filename: '{{ home_library_name }}-{{ home_library_ver }}.war' -home_library_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ home_library_gcube_repository }}/org/gcube/data/access/{{ home_library_name }}/{{ home_library_ver}}/{{ home_library_filename }}' -home_library_war_file: '{{ home_library_name }}.war' +home_library_upgrade: False +home_library_version: 1.8.0-4.6.0-149356 +home_library_name: home-library-webapp + +home_library_group_id: org.gcube.data.access +home_library_extension: war +home_library_file: '{{ home_library_name }}-{{ home_library_version }}.{{ home_library_extension }}' diff --git a/smartgears/home_library/tasks/main.yml b/smartgears/home_library/tasks/main.yml index 53ecb8b0..c31a4225 100644 --- a/smartgears/home_library/tasks/main.yml +++ b/smartgears/home_library/tasks/main.yml @@ -1,22 +1,37 @@ --- - block: - - - name: Remove the installed HOME LIBRARY connector before upgrading + - name: Remove the installed home library connector before upgrading file: dest={{ item }} state=absent with_items: - - '{{ smartgears_instance_path }}/webapps/home-library-webapp' - - '{{ smartgears_instance_path }}/webapps/home-library-webapp.war' - when: smartgears_upgrade + - '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}.war' + when: home_library_upgrade - - name: Get the HOME LIBRARY connector war file - get_url: url={{ home_library_url }} dest={{ smartgears_instance_path }}/webapps/{{ home_library_war_file }} + - maven_artifact: artifact_id={{ home_library_name }} version={{ home_library_version | default(omit) }} group_id={{ home_library_group_id }} extension={{ home_library_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_user_home }}/{{ home_library_file }} + + - name: Create the home library working directory + file: path={{ smartgears_instance_path }}/webapps/{{ home_library_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} + + - name: Unarchive the home library war + unarchive: copy=no src={{ smartgears_user_home }}/{{ home_library_file }} dest={{ smartgears_instance_path }}/webapps/{{ home_library_name }} + args: + creates: '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}/WEB-INF/lib' + notify: Restart smartgears -# - name: Unpack the HOME LIBRARY connector war file -# shell: mkdir {{ smartgears_instance_path }}/webapps/home-library-webapp ; cd {{ smartgears_instance_path }}/webapps/home-library-webapp ; jar xf {{ smartgears_instance_path }}/webapps/{{ home_library_war_file }} -# args: -# creates: '{{ smartgears_instance_path }}/webapps/home-library-webapp/WEB-INF/web.xml' - become: True become_user: '{{ smartgears_user }}' when: home_library_install tags: [ 'smartgears', 'home_library', 'tomcat' ] + + +- block: + - name: Remove the installed home library whe we do not want it installed + file: dest={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}.war' + + become: True + become_user: '{{ smartgears_user }}' + when: not home_library_install + tags: [ 'smartgears', 'home_library', 'tomcat' ]