home library: fix the upgrade scenario.

This commit is contained in:
Andrea Dell'Amico 2017-09-25 18:56:46 +02:00
parent 9366988168
commit 730c0190d2
1 changed files with 16 additions and 21 deletions

View File

@ -1,21 +1,28 @@
--- ---
- block: - 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 file: dest={{ item }} state=absent
with_items: with_items:
- '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}' - '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}'
- '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}.war' - '{{ 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 - block:
file: path={{ smartgears_instance_path }}/webapps/{{ home_library_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} - 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 - name: Remove the installed home library before upgrading
unarchive: copy=no src={{ smartgears_user_home }}/{{ home_library_file }} dest={{ smartgears_instance_path }}/webapps/{{ home_library_name }} file: dest={{ smartgears_instance_path }}/webapps/{{ home_library_name }} state=absent
args: when: ( home_library_download | changed )
creates: '{{ smartgears_instance_path }}/webapps/{{ home_library_name }}/WEB-INF/lib' 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 notify: Restart smartgears
- name: Create the JackRabbit persistence directory - name: Create the JackRabbit persistence directory
@ -32,15 +39,3 @@
when: home_library_install when: home_library_install
tags: [ 'smartgears', 'home_library', 'tomcat' ] 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' ]