From 8ddf7dd9d960d433f2f1e141a73704b202818577 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 6 Aug 2018 19:48:24 +0200 Subject: [PATCH] Role that installs the grsf_api service --- smartgears/grsf_api/defaults/main.yml | 7 ++++++ smartgears/grsf_api/tasks/main.yml | 32 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 smartgears/grsf_api/defaults/main.yml create mode 100644 smartgears/grsf_api/tasks/main.yml diff --git a/smartgears/grsf_api/defaults/main.yml b/smartgears/grsf_api/defaults/main.yml new file mode 100644 index 00000000..53351645 --- /dev/null +++ b/smartgears/grsf_api/defaults/main.yml @@ -0,0 +1,7 @@ +--- +grsf_api_install: False +grsf_api_ver: latest +grsf_api_group_id: gr.forth.ics.isl +grsf_api_name: grsf-api +grsf_api_extension: war +grsf_api_file: '{{ grsf_api_name }}-{{ grsf_api_ver }}.{{ grsf_api_extension }}' diff --git a/smartgears/grsf_api/tasks/main.yml b/smartgears/grsf_api/tasks/main.yml new file mode 100644 index 00000000..c796fd10 --- /dev/null +++ b/smartgears/grsf_api/tasks/main.yml @@ -0,0 +1,32 @@ +--- +- block: + - name: Remove the old grsf-api files + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ grsf_api_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ grsf_api_name }}.{{ grsf_api_extension }}' + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'grsf_api', 'tomcat' ] + when: not grsf_api_install + +- block: + - name: Get the grsf-api war + maven_artifact: artifact_id={{ grsf_api_name }} version={{ grsf_api_version | default(omit) }} group_id={{ grsf_api_group_id }} extension={{ grsf_api_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ grsf_api_file }} + register: grsf_api_download + + - name: Remove the old grsf-api files + file: path={{ smartgears_instance_path }}/webapps/{{ grsf_api_name }} state=absent + notify: Restart smartgears + when: grsf_api_download is changed + + - name: Copy the GRSF publisher under the webapps directory + copy: src={{ smartgears_downloads_dir }}/{{ grsf_api_file }} dest={{ smartgears_instance_path }}/webapps/{{ grsf_api_name }}.{{ grsf_api_extension }} remote_src=yes force=yes + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'grsf_api', 'tomcat' ] + when: grsf_api_install