From 730c0190d2ef278329511ecebd41b683d912d11a Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 25 Sep 2017 18:56:46 +0200 Subject: [PATCH] home library: fix the upgrade scenario. --- smartgears/home_library/tasks/main.yml | 37 +++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/smartgears/home_library/tasks/main.yml b/smartgears/home_library/tasks/main.yml index b48b8db..f4b9948 100644 --- a/smartgears/home_library/tasks/main.yml +++ b/smartgears/home_library/tasks/main.yml @@ -1,21 +1,28 @@ --- - block: - - name: Remove the installed home library connector before upgrading + - 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' - when: home_library_upgrade + notify: Restart smartgears - - 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 }} + become: True + become_user: '{{ smartgears_user }}' + when: not home_library_install + tags: [ 'smartgears', 'home_library', 'tomcat' ] - - name: Create the home library working directory - file: path={{ smartgears_instance_path }}/webapps/{{ home_library_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} +- block: + - 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_downloads_dir }}/{{ home_library_file }} + register: home_library_download - - 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' + - name: Remove the installed home library before upgrading + file: dest={{ smartgears_instance_path }}/webapps/{{ home_library_name }} state=absent + when: ( home_library_download | changed ) + notify: Restart smartgears + + - name: Copy the home library war + copy: src={{ smartgears_downloads_dir }}/{{ home_library_file }} dest={{ smartgears_instance_path }}/webapps/{{ home_library_name }}.{{ home_library_extension | default('war') }} remote_src=yes force=yes notify: Restart smartgears - name: Create the JackRabbit persistence directory @@ -32,15 +39,3 @@ 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' ]