diff --git a/smartgears/sdi_service/defaults/main.yml b/smartgears/sdi_service/defaults/main.yml new file mode 100644 index 00000000..ab75070d --- /dev/null +++ b/smartgears/sdi_service/defaults/main.yml @@ -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 }}' + diff --git a/smartgears/sdi_service/handlers/main.yml b/smartgears/sdi_service/handlers/main.yml new file mode 100644 index 00000000..a9b4ffdd --- /dev/null +++ b/smartgears/sdi_service/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: Restart smartgears + service: name='tomcat-instance-{{ smartgears_http_port }}' state=restarted diff --git a/smartgears/sdi_service/tasks/main.yml b/smartgears/sdi_service/tasks/main.yml new file mode 100644 index 00000000..a09f124a --- /dev/null +++ b/smartgears/sdi_service/tasks/main.yml @@ -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' ]