From c8b805e48b1ae5f1f1e7dbf0c1a290eff177a04a Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 5 Dec 2018 15:27:14 +0100 Subject: [PATCH] Created playbook skeleton for gcat service --- smartgears/gcat/defaults/main.yml | 9 +++++ smartgears/gcat/tasks/main.yml | 36 +++++++++++++++++++ .../gcat/templates/config.properties.j2 | 1 + 3 files changed, 46 insertions(+) create mode 100644 smartgears/gcat/defaults/main.yml create mode 100644 smartgears/gcat/tasks/main.yml create mode 100644 smartgears/gcat/templates/config.properties.j2 diff --git a/smartgears/gcat/defaults/main.yml b/smartgears/gcat/defaults/main.yml new file mode 100644 index 00000000..52bac342 --- /dev/null +++ b/smartgears/gcat/defaults/main.yml @@ -0,0 +1,9 @@ +--- +gcat_install: False +gcat_version: latest +gcat_name: gcat + +gcat_group_id: org.gcube.data-publishing +gcat_extension: war +gcat_file: '{{ gcat_name }}-{{ gcat_version }}.{{ gcat_extension }}' + diff --git a/smartgears/gcat/tasks/main.yml b/smartgears/gcat/tasks/main.yml new file mode 100644 index 00000000..727fd9d5 --- /dev/null +++ b/smartgears/gcat/tasks/main.yml @@ -0,0 +1,36 @@ +--- +- block: + - name: Remove the old catalogue ws files + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ gcat_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ gcat_name }}.{{ gcat_extension }}' + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + when: not gcat_install + 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 }} + register: gcat_download + + - name: Remove the old catalogue ws files + file: path={{ smartgears_instance_path }}/webapps/{{ gcat_name }} state=absent + when: gcat_download is changed + + - 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 + tags: [ 'smartgears', 'gcat', 'tomcat' ] + diff --git a/smartgears/gcat/templates/config.properties.j2 b/smartgears/gcat/templates/config.properties.j2 new file mode 100644 index 00000000..a8ac45e6 --- /dev/null +++ b/smartgears/gcat/templates/config.properties.j2 @@ -0,0 +1 @@ +TOKEN={{ gcat_application_token }}