forked from ISTI-ansible-roles/ansible-roles
sdi_service: cleanup the tasks so they make a better use of the maven_artifact plugin.
This commit is contained in:
parent
cf7af19fd2
commit
e46967c586
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
sdi_service_install: False
|
||||
sdi_service_upgrade: False
|
||||
sdi_service_version: 1.1.0-4.6.1-153203
|
||||
sdi_service_version: latest
|
||||
sdi_service_name: sdi-service
|
||||
|
||||
sdi_group_id: org.gcube.spatial.data
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
---
|
||||
- block:
|
||||
- name: Remove the old sdi files
|
||||
file: path={{ smartgears_instance_path }}/webapps/{{ sdi_service_name }} state=absent
|
||||
when: sdi_service_upgrade
|
||||
file: path={{ item }} state=absent
|
||||
with_items:
|
||||
- '{{ smartgears_instance_path }}/webapps/{{ sdi_service_name }}'
|
||||
- '{{ smartgears_instance_path }}/webapps/{{ sdi_service_name }}.{{ sdi_extension }}'
|
||||
|
||||
# NOTE: Install as the smartgears user so we do not mess with the permissions
|
||||
become: True
|
||||
become_user: '{{ d4science_user }}'
|
||||
when: not sdi_service_install
|
||||
tags: [ 'smartgears', 'sdi_service', 'tomcat' ]
|
||||
|
||||
- block:
|
||||
- name: Get the sdi-service
|
||||
maven_artifact: artifact_id={{ sdi_service_name }} version={{ sdi_service_version | default(omit) }} group_id={{ sdi_group_id }} extension={{ sdi_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_user_home }}/{{ sdi_service_file }}
|
||||
maven_artifact: artifact_id={{ sdi_service_name }} version={{ sdi_service_version | default('latest') }} group_id={{ sdi_group_id }} extension={{ sdi_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ sdi_service_file }}
|
||||
register: sdi_service_download
|
||||
|
||||
- name: Create the sdi working directory
|
||||
file: path={{ smartgears_instance_path }}/webapps/{{ sdi_service_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }}
|
||||
|
||||
- name: Unarchive the sdi war
|
||||
unarchive: copy=no src={{ smartgears_user_home }}/{{ sdi_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ sdi_service_name }} creates={{ smartgears_instance_path }}/webapps/{{ sdi_service_name }}/WEB-INF/lib
|
||||
- name: Remove the old sdi files
|
||||
file: path={{ smartgears_instance_path }}/webapps/{{ sdi_service_name }} state=absent
|
||||
when: ( sdi_service_download | changed )
|
||||
|
||||
- name: Copy the sdi service war file into the webapps directory
|
||||
copy: src={{ smartgears_downloads_dir }}/{{ sdi_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ sdi_service_name }}.{{ sdi_extension }} remote_src=yes force=yes
|
||||
notify: Restart smartgears
|
||||
|
||||
become: True
|
||||
|
@ -20,11 +29,3 @@
|
|||
when: sdi_service_install
|
||||
tags: [ 'smartgears', 'sdi_service', 'tomcat' ]
|
||||
|
||||
- block:
|
||||
- name: Remove the old sdi files
|
||||
file: path={{ smartgears_instance_path }}/webapps/{{ sdi_service_name }} state=absent
|
||||
|
||||
become: True
|
||||
become_user: '{{ d4science_user }}'
|
||||
when: not sdi_service_install
|
||||
tags: [ 'smartgears', 'sdi_service', 'tomcat' ]
|
||||
|
|
Loading…
Reference in New Issue