From 55471f70219e34fe651aec78164d54e884b6dcf4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 6 Aug 2018 19:36:34 +0200 Subject: [PATCH] Role that installs the GRSF services updater --- .../grsf_services_updater/defaults/main.yml | 7 ++++ .../grsf_services_updater/tasks/main.yml | 32 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 smartgears/grsf_services_updater/defaults/main.yml create mode 100644 smartgears/grsf_services_updater/tasks/main.yml diff --git a/smartgears/grsf_services_updater/defaults/main.yml b/smartgears/grsf_services_updater/defaults/main.yml new file mode 100644 index 00000000..c7e883d6 --- /dev/null +++ b/smartgears/grsf_services_updater/defaults/main.yml @@ -0,0 +1,7 @@ +--- +grsf_services_updater_install: False +grsf_services_updater_ver: latest +grsf_services_updater_group_id: gr.forth.ics.isl +grsf_services_updater_name: grsf-services-updater +grsf_services_updater_extension: war +grsf_services_updater_file: '{{ grsf_services_updater_name }}-{{ grsf_services_updater_ver }}.{{ grsf_services_updater_extension }}' diff --git a/smartgears/grsf_services_updater/tasks/main.yml b/smartgears/grsf_services_updater/tasks/main.yml new file mode 100644 index 00000000..2f9a43aa --- /dev/null +++ b/smartgears/grsf_services_updater/tasks/main.yml @@ -0,0 +1,32 @@ +--- +- block: + - name: Remove the old grsf-publisher-ws files + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ grsf_services_updater_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ grsf_services_updater_name }}.{{ grsf_services_updater_extension }}' + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'grsf_services_updater', 'tomcat' ] + when: not grsf_services_updater_install + +- block: + - name: Get the grsf-publisher-ws war + maven_artifact: artifact_id={{ grsf_services_updater_name }} version={{ grsf_services_updater_version | default(omit) }} group_id={{ grsf_services_updater_group_id }} extension={{ grsf_services_updater_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ grsf_services_updater_file }} + register: grsf_publisher_download + + - name: Remove the old grsf-publisher-ws files + file: path={{ smartgears_instance_path }}/webapps/{{ grsf_services_updater_name }} state=absent + notify: Restart smartgears + when: ( grsf_publisher_download | changed ) + + - name: Copy the GRSF publisher under the webapps directory + copy: src={{ smartgears_downloads_dir }}/{{ grsf_services_updater_file }} dest={{ smartgears_instance_path }}/webapps/{{ grsf_services_updater_name }}.{{ grsf_services_updater_extension }} remote_src=yes force=yes + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'grsf_services_updater', 'tomcat' ] + when: grsf_services_updater_install