From 8a8005a4845f0408905a07917bc8d4be6b8f05ca Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 5 May 2017 13:07:03 +0200 Subject: [PATCH] library/roles/smartgears/catalogue_ws: role to install the catalogue ws service. --- smartgears/catalogue_ws/defaults/main.yml | 10 ++++++++ smartgears/catalogue_ws/tasks/main.yml | 30 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 smartgears/catalogue_ws/defaults/main.yml create mode 100644 smartgears/catalogue_ws/tasks/main.yml diff --git a/smartgears/catalogue_ws/defaults/main.yml b/smartgears/catalogue_ws/defaults/main.yml new file mode 100644 index 00000000..6d1d4227 --- /dev/null +++ b/smartgears/catalogue_ws/defaults/main.yml @@ -0,0 +1,10 @@ +--- +catalogue_ws_install: False +catalogue_ws_upgrade: False +catalogue_ws_version: latest +catalogue_ws_name: catalogue-ws + +catalogue_ws_group_id: org.gcube.data-catalogue +catalogue_ws_extension: war +catalogue_ws_file: '{{ catalogue_ws_name }}-{{ catalogue_ws_version }}.{{ catalogue_ws_extension }}' + diff --git a/smartgears/catalogue_ws/tasks/main.yml b/smartgears/catalogue_ws/tasks/main.yml new file mode 100644 index 00000000..66dfa12f --- /dev/null +++ b/smartgears/catalogue_ws/tasks/main.yml @@ -0,0 +1,30 @@ +--- +- block: + - name: Remove the old catalogue ws files + file: path={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }} state=absent + when: catalogue_ws_upgrade + + # NOTE: Install as the smartgears user so we do not mess with the permissions + - name: Get the catalogue-ws + maven_artifact: artifact_id={{ catalogue_ws_name }} version={{ catalogue_ws_version | default(omit) }} group_id={{ catalogue_ws_group_id }} extension={{ catalogue_ws_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_user_home }}/{{ catalogue_ws_file }} + + - name: Create the catalogue ws working directory + file: path={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} + + - name: Unarchive the catalogue ws war + unarchive: copy=no src={{ smartgears_user_home }}/{{ catalogue_ws_file }} dest={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }} creates={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }}/WEB-INF/lib + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + when: catalogue_ws_install + tags: [ 'smartgears', 'catalogue_ws', 'tomcat' ] + +- block: + - name: Remove the old catalogue ws files + file: path={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }} state=absent + + become: True + become_user: '{{ d4science_user }}' + when: not catalogue_ws_install + tags: [ 'smartgears', 'catalogue_ws', 'tomcat' ]