library/roles/smartgears/sdi_service: Role that installs the sdi service webapp.

This commit is contained in:
Andrea Dell'Amico 2017-04-20 19:00:20 +02:00
parent 5fa669d71b
commit 33eafc19c9
3 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,10 @@
---
sdi_service_install: False
sdi_service_upgrade: False
sdi_service_version: 1.0.0-4.4.0-146794
sdi_service_name: sdi-service
sdi_group_id: org.gcube.spatial.data
sdi_extension: war
sdi_service_file: '{{ sdi_service_name }}-{{ sdi_service_version }}.{{ sdi_extension }}'

View File

@ -0,0 +1,3 @@
---
- name: Restart smartgears
service: name='tomcat-instance-{{ smartgears_http_port }}' state=restarted

View File

@ -0,0 +1,30 @@
---
- block:
- name: Remove the old sdi files
file: path={{ smartgears_instance_path }}/webapps/{{ sdi_service_name }} state=absent
when: sdi_service_upgrade
# NOTE: Install as the smartgears user so we do not mess with the permissions
- 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 }}
- 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
notify: Restart smartgears
become: True
become_user: '{{ d4science_user }}'
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' ]