From 15c60e25bfe4dd60c6ac6dc5347c3e25f0bd1ca2 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 5 Dec 2018 17:43:39 +0100 Subject: [PATCH] Fixing playbook skeleton for gcat service --- smartgears/gcat/tasks/main.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/smartgears/gcat/tasks/main.yml b/smartgears/gcat/tasks/main.yml index 1f18728f..a7e1ada2 100644 --- a/smartgears/gcat/tasks/main.yml +++ b/smartgears/gcat/tasks/main.yml @@ -13,22 +13,29 @@ tags: [ 'smartgears', 'gcat', 'tomcat' ] - block: - - name: Get the catalogue-ws - maven_artifact: artifact_id={{ gcat_name }} version={{ gcat_version | default(omit) }} group_id={{ gcat_group_id }} extension={{ gcat_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ gcat_file }} verify_checksum=always + - name: Get the gcat war + maven_artifact: artifact_id={{ gcat_name }} version={{ gcat_version | default('latest') }} group_id={{ gcat_group_id }} extension={{ gcat_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ gcat_file }} verify_checksum=always register: gcat_download - - name: Remove the old catalogue ws files - file: path={{ smartgears_instance_path }}/webapps/{{ gcat_name }} state=absent + - name: Remove the old gcat files + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ gcat_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ gcat_name }}.{{ gcat_extension }}' + when: gcat_download is changed + + - name: Create the gcat working directory + file: path={{ smartgears_instance_path }}/webapps/{{ gcat_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} when: gcat_download is changed + - name: Unarchive the gcat war + unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ gcat_file }} dest={{ smartgears_instance_path }}/webapps/{{ gcat_name }} creates={{ smartgears_instance_path }}/webapps/{{ gcat_name }}/WEB-INF/lib + notify: Restart smartgears + - name: Install the gcat configuration template: src=config.properties.j2 dest={{ smartgears_instance_path }}/webapps/{{ gcat_name }}/WEB-INF/classes/config.properties mode=0440 notify: Restart smartgears - - name: Copy the catalogue ws war into the tomcat webapps directory - copy: src={{ smartgears_downloads_dir }}/{{ gcat_file }} dest={{ smartgears_instance_path }}/webapps/{{ gcat_name }}.{{ gcat_extension }} remote_src=yes force=yes - notify: Restart smartgears - become: True become_user: '{{ d4science_user }}' when: gcat_install