From 6f4d5cf7d14004e085c26832e999e357cc4de959 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 7 May 2019 18:35:26 +0200 Subject: [PATCH] tasks for the new generic smartgears service role --- .../smartgears-generic-service/tasks/main.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 smartgears/smartgears-generic-service/tasks/main.yml diff --git a/smartgears/smartgears-generic-service/tasks/main.yml b/smartgears/smartgears-generic-service/tasks/main.yml new file mode 100644 index 00000000..6590716e --- /dev/null +++ b/smartgears/smartgears-generic-service/tasks/main.yml @@ -0,0 +1,46 @@ +--- +- block: + - name: Remove the old service files + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }}.{{ smartgears_generic_service_extension }}' + notify: Restart smartgears + check_mode: yes + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears_generic_service' ] + when: not smartgears_generic_service_install + +- block: + - name: Get the smartgears-service war + maven_artifact: artifact_id={{ smartgears_generic_service_name }} version={{ smartgears_generic_service_version | default(omit) }} group_id={{ smartgears_generic_service_group_id }} extension={{ smartgears_generic_service_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ smartgears_generic_service_file }} verify_checksum=always + register: smartgears_generic_service_download + + - name: Remove the old service files + file: path={{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }} state=absent + notify: Restart smartgears + when: smartgears_generic_service_download is changed + check_mode: yes + + - name: Copy the service under the webapps directory + copy: src={{ smartgears_downloads_dir }}/{{ smartgears_generic_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }}.{{ smartgears_generic_service_extension }} remote_src=yes force=yes + notify: Restart smartgears + check_mode: yes + + - name: Create the service webapp directory + file: dest={{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }} state=directory + when: smartgears_generic_service_download + + - name: Unarchive the service war file + unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ smartgears_generic_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }} + notify: Restart smartgears + + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears_generic_service' ] + when: smartgears_generic_service_install + check_mode: yes +