From 478ad025f28d9096e257813e266e296a2a057f68 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 24 Nov 2017 16:56:24 +0100 Subject: [PATCH] ckan-connector, r-connector, resource-registry: Remove the war file from tomcat/webapps when upgrading. --- smartgears/ckan_connector/tasks/main.yml | 9 +++++++-- smartgears/r_connector/tasks/main.yml | 8 +++++++- smartgears/resource_registry/tasks/main.yml | 10 +++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/smartgears/ckan_connector/tasks/main.yml b/smartgears/ckan_connector/tasks/main.yml index caec64bc..5399c5d2 100644 --- a/smartgears/ckan_connector/tasks/main.yml +++ b/smartgears/ckan_connector/tasks/main.yml @@ -5,7 +5,7 @@ with_items: - '{{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}' - '{{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}.{{ ckan_connector_extension }}' - when: smartgears_upgrade + notify: Restart smartgears - name: Remove the CKAN connector fixer script become_user: root @@ -22,8 +22,12 @@ register: ckan_connector_download - name: Remove the installed CKAN connector before upgrading - file: dest={{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }} state=absent + file: dest={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}.{{ ckan_connector_extension }}' when: ( ckan_connector_download | changed ) + notify: Restart smartgears - name: Create the CKAN connector webapp directory file: dest={{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }} state=directory @@ -33,6 +37,7 @@ unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ ckan_connector_filename }} dest={{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }} args: creates: '{{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}/WEB-INF/web.xml' + notify: Restart smartgears - name: Install the CKAN connector web.xml template template: src=ckan-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/.web.xml.tpl mode=0440 diff --git a/smartgears/r_connector/tasks/main.yml b/smartgears/r_connector/tasks/main.yml index 83760d38..1d936a6a 100644 --- a/smartgears/r_connector/tasks/main.yml +++ b/smartgears/r_connector/tasks/main.yml @@ -24,6 +24,7 @@ become: True become_user: '{{ smartgears_user }}' when: not r_connector_install + notify: Restart smartgears tags: [ 'smartgears', 'r_connector', 'tomcat' ] - block: @@ -32,7 +33,11 @@ register: r_connector_download - name: Remove the installed R connector before upgrading - file: dest={{ smartgears_instance_path }}/webapps/{{ r_connector_name }} state=absent + file: dest={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ r_connector_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ r_connector_name }}.{{ r_connector_extension }}' + notify: Restart smartgears when: ( r_connector_download | changed ) - name: Create the R connector webapp directory @@ -43,6 +48,7 @@ unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ r_connector_filename }} dest={{ smartgears_instance_path }}/webapps/{{ r_connector_name }} args: creates: '{{ smartgears_instance_path }}/webapps/{{ r_connector_name }}/WEB-INF/web.xml' + notify: Restart smartgears - name: Obtain the permission to read the Rstudio secure cookie key become_user: root diff --git a/smartgears/resource_registry/tasks/main.yml b/smartgears/resource_registry/tasks/main.yml index a369223f..b8ed65bb 100644 --- a/smartgears/resource_registry/tasks/main.yml +++ b/smartgears/resource_registry/tasks/main.yml @@ -5,6 +5,7 @@ with_items: - '{{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}' - '{{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}.{{ resource_registry_extension }}' + notify: Restart smartgears become: True become_user: '{{ d4science_user }}' @@ -17,17 +18,16 @@ register: resource_registry_download - name: Remove the old resource-registry files - file: path={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} state=absent + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}.{{ resource_registry_extension }}' when: ( resource_registry_download | changed ) - name: Create the resource-registry working directory file: path={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} when: ( resource_registry_download | changed ) - - name: Copy the resource registry war file into the webapps directory - copy: src={{ smartgears_downloads_dir }}/{{ resource_registry_file }} dest={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}.{{ resource_registry_extension }} remote_src=yes force=yes - notify: Restart smartgears - - name: Unarchive the resource registry war unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ resource_registry_file }} dest={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} creates={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}/WEB-INF/lib notify: Restart smartgears