spd service: better use of maven artifact.

This commit is contained in:
Andrea Dell'Amico 2017-10-19 19:03:00 +02:00
parent b4e9b0b349
commit 2858824409
1 changed files with 18 additions and 17 deletions

View File

@ -1,18 +1,27 @@
--- ---
- block: - block:
- name: Remove the old spd files - name: Remove the old spd files
file: path={{ smartgears_instance_path }}/webapps/{{ spd_service_name }} state=absent file: path={{ item }} state=absent
when: spd_service_upgrade with_items:
- '{{ smartgears_instance_path }}/webapps/{{ spd_service_name }}'
- '{{ smartgears_instance_path }}/webapps/{{ spd_service_name }}.{{ spd_extension }}'
# NOTE: Install as the smartgears user so we do not mess with the permissions become: True
become_user: '{{ d4science_user }}'
when: not spd_service_install
tags: [ 'smartgears', 'spd_service', 'tomcat' ]
- block:
- name: Get the spd-service - name: Get the spd-service
maven_artifact: artifact_id={{ spd_service_name }} version={{ spd_service_version | default(omit) }} group_id={{ spd_group_id }} extension={{ spd_extension | default('war') }} repository_url={{ spd_service_repository_url }} dest={{ smartgears_user_home }}/{{ spd_service_file }} maven_artifact: artifact_id={{ spd_service_name }} version={{ spd_service_version | default('latest') }} group_id={{ spd_group_id }} extension={{ spd_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ spd_service_file }}
register: spd_service_download
- name: Create the spd working directory - name: Remove the old spd files
file: path={{ smartgears_instance_path }}/webapps/{{ spd_service_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} file: path={{ smartgears_instance_path }}/webapps/{{ spd_service_name }} state=absent
when: ( spd_service_download | changed )
- name: Unarchive the spd war - name: Copy the spd war into the webapps directory
unarchive: copy=no src={{ smartgears_user_home }}/{{ spd_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ spd_service_name }} creates={{ smartgears_instance_path }}/webapps/{{ spd_service_name }}/WEB-INF/lib copy: src={{ smartgears_downloads_dir }}/{{ spd_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ spd_service_name }}.{{ spd_extension }} remote_src=yes force=yes
notify: Restart smartgears notify: Restart smartgears
become: True become: True
@ -20,11 +29,3 @@
when: spd_service_install when: spd_service_install
tags: [ 'smartgears', 'spd_service', 'tomcat' ] tags: [ 'smartgears', 'spd_service', 'tomcat' ]
- block:
- name: Remove the old spd files
file: path={{ smartgears_instance_path }}/webapps/{{ spd_service_name }} state=absent
become: True
become_user: '{{ d4science_user }}'
when: not spd_service_install
tags: [ 'smartgears', 'spd_service', 'tomcat' ]