From 81e7811be5b27a44d8b5dc45e3fe0ddf830749c9 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 15 Jan 2019 17:44:57 +0100 Subject: [PATCH] Role that installs the perform-service app. --- smartgears/perform_service/defaults/main.yml | 8 +++++ smartgears/perform_service/tasks/main.yml | 31 ++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 smartgears/perform_service/defaults/main.yml create mode 100644 smartgears/perform_service/tasks/main.yml diff --git a/smartgears/perform_service/defaults/main.yml b/smartgears/perform_service/defaults/main.yml new file mode 100644 index 0000000..9d4fd30 --- /dev/null +++ b/smartgears/perform_service/defaults/main.yml @@ -0,0 +1,8 @@ +--- +perform_service_install: False +perform_service_version: latest +smartgears_webapp_name: perform-service +perform_service_name: '{{ smartgears_webapp_name }}' +perform_group_id: org.gcube.application +perform_extension: war +perform_service_file: '{{ perform_service_name }}-{{ perform_service_version }}.{{ perform_extension }}' diff --git a/smartgears/perform_service/tasks/main.yml b/smartgears/perform_service/tasks/main.yml new file mode 100644 index 0000000..edb05c8 --- /dev/null +++ b/smartgears/perform_service/tasks/main.yml @@ -0,0 +1,31 @@ +--- +- block: + - name: Remove the old perform files + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ perform_service_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ perform_service_name }}.{{ perform_extension }}' + + become: True + become_user: '{{ d4science_user }}' + when: not perform_service_install + tags: [ 'smartgears', 'perform_service', 'tomcat' ] + +- block: + - name: Get the perform-service + maven_artifact: artifact_id={{ perform_service_name }} version={{ perform_service_version | default('latest') }} group_id={{ perform_group_id }} extension={{ perform_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ perform_service_file }} verify_checksum=always + register: perform_service_download + + - name: Remove the old perform files + file: path={{ smartgears_instance_path }}/webapps/{{ perform_service_name }} state=absent + when: perform_service_download is changed + + - name: Copy the perform war into the webapps directory + copy: src={{ smartgears_downloads_dir }}/{{ perform_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ perform_service_name }}.{{ perform_extension }} remote_src=yes force=yes + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + when: perform_service_install + tags: [ 'smartgears', 'perform_service', 'tomcat' ] +