From e68e5a6fee02e22b784fab3e100e1cab9708448e Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 9 Nov 2017 18:36:57 +0100 Subject: [PATCH 1/2] catalina-app-conf: Simple role that installs a custom catalina app configuration. --- smartgears/catalina-app-conf/tasks/main.yml | 17 +++++++++++++++++ .../templates/catalina-app-conf.xml.j2 | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 smartgears/catalina-app-conf/tasks/main.yml create mode 100644 smartgears/catalina-app-conf/templates/catalina-app-conf.xml.j2 diff --git a/smartgears/catalina-app-conf/tasks/main.yml b/smartgears/catalina-app-conf/tasks/main.yml new file mode 100644 index 0000000..1dd6cbe --- /dev/null +++ b/smartgears/catalina-app-conf/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- block: + - name: Install the catalina webapp configurations + template: src=catalina-app-conf.xml.j2 dest={{ smartgears_instance_path }}/conf/Catalina/localhost/{{ item.app_name }}.xml + with_items: '{{ catalina_apps_conf }}' + when: ( item.state | default(True) ) + + - name: Remove the catalina webapp configurations + file: dest={{ smartgears_instance_path }}/conf/Catalina/localhost/{{ item.app_name }}.xml state=absent + with_items: '{{ catalina_apps_conf }}' + when: ( not item.state | default(True) ) + + become: True + become_user: '{{ smartgears_user }}' + when: catalina_apps_conf is defined + tags: [ 'smartgears', 'tomcat', 'catalina_apps' ] + diff --git a/smartgears/catalina-app-conf/templates/catalina-app-conf.xml.j2 b/smartgears/catalina-app-conf/templates/catalina-app-conf.xml.j2 new file mode 100644 index 0000000..3a858ef --- /dev/null +++ b/smartgears/catalina-app-conf/templates/catalina-app-conf.xml.j2 @@ -0,0 +1,7 @@ + + + + + + From 1cddd28d37599d01f0a96bebfc5e9ac4723bf445 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 9 Nov 2017 18:37:28 +0100 Subject: [PATCH 2/2] sis_geotk_dt_plugin: Manage the uber jar as an additional app plugin. See https://support.d4science.org/issues/10202 --- .../sis_geotk_dt_plugin/defaults/main.yml | 2 ++ smartgears/sis_geotk_dt_plugin/meta/main.yml | 4 ++++ smartgears/sis_geotk_dt_plugin/tasks/main.yml | 17 ++++++++++++----- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 smartgears/sis_geotk_dt_plugin/meta/main.yml diff --git a/smartgears/sis_geotk_dt_plugin/defaults/main.yml b/smartgears/sis_geotk_dt_plugin/defaults/main.yml index 7b066e2..fe7e067 100644 --- a/smartgears/sis_geotk_dt_plugin/defaults/main.yml +++ b/smartgears/sis_geotk_dt_plugin/defaults/main.yml @@ -9,3 +9,5 @@ sis_geotk_dt_plugin_extension: jar sis_geotk_dt_plugin_classifier: jar-with-dependencies sis_geotk_dt_plugin_file: '{{ sis_geotk_dt_plugin_name }}-{{ sis_geotk_dt_plugin_version }}-jar-with-dependencies.{{ sis_geotk_dt_plugin_extension }}' +catalina_apps_conf: + - { app_name: '{{ data_trasfer_service_name }}', plugin_name: '{{ sis_geotk_dt_plugin_name }}' } diff --git a/smartgears/sis_geotk_dt_plugin/meta/main.yml b/smartgears/sis_geotk_dt_plugin/meta/main.yml new file mode 100644 index 0000000..2510b86 --- /dev/null +++ b/smartgears/sis_geotk_dt_plugin/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: '../library/roles/smartgears/catalina-app-conf' + diff --git a/smartgears/sis_geotk_dt_plugin/tasks/main.yml b/smartgears/sis_geotk_dt_plugin/tasks/main.yml index 924ac0f..4fbd92a 100644 --- a/smartgears/sis_geotk_dt_plugin/tasks/main.yml +++ b/smartgears/sis_geotk_dt_plugin/tasks/main.yml @@ -1,26 +1,33 @@ --- - block: - name: Remove the old Sis geotk data transfer plugin - shell: rm -f {{ smartgears_instance_path }}/webapps/{{ data_trasfer_service_name }}/WEB-INF/lib/{{ sis_geotk_dt_plugin_name }}-*-jar-with-dependencies.jar - + file: dest={{ smartgears_instance_path }}/webapps/{{ data_trasfer_service_name }}/WEB-INF/lib/plugins/{{ sis_geotk_dt_plugin_name }} state=absent + become: True become_user: '{{ smartgears_user }}' when: not sis_geotk_dt_plugin_install tags: [ 'smartgears', 'sis_geotk', 'tomcat' ] - block: - - name: Get the Sis geotk data transfer plugin and install it inside the smart executor + - name: Create the plugin directory inside data transfer + file: dest={{ smartgears_instance_path }}/webapps/{{ data_trasfer_service_name }}/WEB-INF/lib/plugins/{{ sis_geotk_dt_plugin_name }} state=directory + + - name: Get the Sis geotk data transfer plugin maven_artifact: artifact_id={{ sis_geotk_dt_plugin_name }} version={{ sis_geotk_dt_plugin_version | default(omit) }} group_id={{ sis_geotk_dt_plugin_group_id }} extension={{ sis_geotk_dt_plugin_extension | default('war') }} repository_url={{ smartgears_global_base_url }} classifier={{ sis_geotk_dt_plugin_classifier }} dest={{ smartgears_downloads_dir }}/{{ sis_geotk_dt_plugin_file }} register: sis_geotk_download - name: Remove the old Sis geotk data transfer plugin - shell: rm -f {{ smartgears_instance_path }}/webapps/{{ data_trasfer_service_name }}/WEB-INF/lib/{{ sis_geotk_dt_plugin_name }}-*-jar-with-dependencies.jar + file: dest={{ smartgears_instance_path }}/webapps/{{ data_trasfer_service_name }}/WEB-INF/lib/plugins/{{ sis_geotk_dt_plugin_name }} state=absent when: (sis_geotk_download | changed) - name: Copy the Sis geotk data transfer plugin to its final destination - copy: src={{ smartgears_downloads_dir }}/{{ sis_geotk_dt_plugin_file }} dest={{ smartgears_instance_path }}/webapps/{{ data_trasfer_service_name }}/WEB-INF/lib/{{ sis_geotk_dt_plugin_file }} remote_src=yes force=yes + copy: src={{ smartgears_downloads_dir }}/{{ sis_geotk_dt_plugin_file }} dest={{ smartgears_instance_path }}/webapps/{{ data_trasfer_service_name }}/WEB-INF/lib/plugins/{{ sis_geotk_dt_plugin_name }}/{{ sis_geotk_dt_plugin_file }} remote_src=yes notify: Restart smartgears + - name: Unarchive the Sis geotk data transfer plugin to expose its libraries + unarchive: src={{ smartgears_downloads_dir }}/{{ sis_geotk_dt_plugin_file }} dest={{ smartgears_instance_path }}/webapps/{{ data_trasfer_service_name }}/WEB-INF/lib/plugins/{{ sis_geotk_dt_plugin_name }}/ copy=no + when: (sis_geotk_download | changed) + become: True become_user: '{{ smartgears_user }}' when: sis_geotk_dt_plugin_install