From ea49eb993a1c513caeead18ee595b1ff51e3518f Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 17:23:17 +0200 Subject: [PATCH 01/14] Move the data_transfer variables from the nginx role to the main smartgears one. --- smartgears/smartgears-nginx-frontend/defaults/main.yml | 1 - smartgears/smartgears/defaults/main.yml | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/smartgears/smartgears-nginx-frontend/defaults/main.yml b/smartgears/smartgears-nginx-frontend/defaults/main.yml index b69e5630..6f1e5b74 100644 --- a/smartgears/smartgears-nginx-frontend/defaults/main.yml +++ b/smartgears/smartgears-nginx-frontend/defaults/main.yml @@ -6,5 +6,4 @@ smartgears_install_generic_virthost: True #smartgears_nginx_serveraliases: smartgears_nginx_cors_enabled: False nginx_cors_acl_origin: '' -data_transfer_service_install: False smartgears_nginx_expose_tomcat_logs: False diff --git a/smartgears/smartgears/defaults/main.yml b/smartgears/smartgears/defaults/main.yml index c1d4dc72..a9fa8b46 100644 --- a/smartgears/smartgears/defaults/main.yml +++ b/smartgears/smartgears/defaults/main.yml @@ -77,3 +77,7 @@ smartgears_debugging_port: '{{ tomcat_m_remote_debugging_port }}' # tcp_rules: True # tcp: # - { port: '{{ smartgears_debugging_port }}', allowed_hosts: [ '{{ network.isti }}', '{{ network.nmis }}', '{{ network.eduroam }}' ] } + +# This is only used to setup the nginx reverse proxy. The data-trasfer war file is always installed +data_transfer_service_install: False +data_trasfer_service_name: data-transfer-service From fb99dba4547aeabcd5f6553a2b5cb1284919ef54 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 17:23:51 +0200 Subject: [PATCH 02/14] Add a role to manage the sis-geotk-plugin (data transfer). --- .../sis_geotk_dt_plugin/defaults/main.yml | 11 ++++++++++ smartgears/sis_geotk_dt_plugin/tasks/main.yml | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 smartgears/sis_geotk_dt_plugin/defaults/main.yml create mode 100644 smartgears/sis_geotk_dt_plugin/tasks/main.yml diff --git a/smartgears/sis_geotk_dt_plugin/defaults/main.yml b/smartgears/sis_geotk_dt_plugin/defaults/main.yml new file mode 100644 index 00000000..7b066e24 --- /dev/null +++ b/smartgears/sis_geotk_dt_plugin/defaults/main.yml @@ -0,0 +1,11 @@ +--- +sis_geotk_dt_plugin_install: False +sis_geotk_dt_plugin_name: sis-geotk-plugin + +sis_geotk_dt_plugin_group_id : org.gcube.data.transfer +sis_geotk_dt_plugin_artifact_id : '{{ sis_geotk_dt_plugin_name }}' +sis_geotk_dt_plugin_version : latest +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 }}' + diff --git a/smartgears/sis_geotk_dt_plugin/tasks/main.yml b/smartgears/sis_geotk_dt_plugin/tasks/main.yml new file mode 100644 index 00000000..73168bb9 --- /dev/null +++ b/smartgears/sis_geotk_dt_plugin/tasks/main.yml @@ -0,0 +1,20 @@ +--- +- block: + - name: Get the Sis geotk data transfer plugin and install it inside the smart executor + 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 + when: (sis_geotk_download | changed) + tags: [ 'smartgears', 'sis_geotk', 'tomcat' ] + + - 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/{{ smart_executor_name }}/WEB-INF/lib/{{ sis_geotk_dt_plugin_file }} remote_src=yes force=yes + notify: Restart smartgears + + become: True + become_user: '{{ smartgears_user }}' + when: sis_geotk_dt_plugin_install + tags: [ 'smartgears', 'sis_geotk', 'tomcat' ] + From 6839589455a58412d60704d7c7f404a5ed0ba0c8 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 17:25:23 +0200 Subject: [PATCH 03/14] Add a task that removes the sis-geotk-plugin when it is not meant to be installed. --- smartgears/sis_geotk_dt_plugin/tasks/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/smartgears/sis_geotk_dt_plugin/tasks/main.yml b/smartgears/sis_geotk_dt_plugin/tasks/main.yml index 73168bb9..7bed52ca 100644 --- a/smartgears/sis_geotk_dt_plugin/tasks/main.yml +++ b/smartgears/sis_geotk_dt_plugin/tasks/main.yml @@ -1,4 +1,13 @@ --- +- 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 + + 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 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 }} @@ -7,7 +16,6 @@ - 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 when: (sis_geotk_download | changed) - tags: [ 'smartgears', 'sis_geotk', 'tomcat' ] - 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/{{ smart_executor_name }}/WEB-INF/lib/{{ sis_geotk_dt_plugin_file }} remote_src=yes force=yes From 603cc237be88c49444d253174d025814e2df8173 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 17:41:52 +0200 Subject: [PATCH 04/14] Fix the downloads dir creation. The ownership must be assigned to the gcube user. --- smartgears/smartgears/tasks/smartgears-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartgears/smartgears/tasks/smartgears-app.yml b/smartgears/smartgears/tasks/smartgears-app.yml index 0460b31c..b3d6c6fd 100644 --- a/smartgears/smartgears/tasks/smartgears-app.yml +++ b/smartgears/smartgears/tasks/smartgears-app.yml @@ -1,6 +1,6 @@ --- - name: Create a directory where to store all the smartgears related downloads to avoid cluttering the home directory - file: dest={{ smartgears_downloads_dir }} state=directory + file: dest={{ smartgears_downloads_dir }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} tags: [ 'smartgears', 'tomcat', 'smartgears_download_dir', 'smartgears_downloads_dir' ] - name: Remove the smartgears distribution archive to force un upgrade From 29e43c5498cc07b146349ba617179141ce9dfdf7 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 17:43:36 +0200 Subject: [PATCH 05/14] Fix a typo in the sis_geotk_dt_plugin role. --- smartgears/sis_geotk_dt_plugin/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartgears/sis_geotk_dt_plugin/tasks/main.yml b/smartgears/sis_geotk_dt_plugin/tasks/main.yml index 7bed52ca..924ac0fc 100644 --- a/smartgears/sis_geotk_dt_plugin/tasks/main.yml +++ b/smartgears/sis_geotk_dt_plugin/tasks/main.yml @@ -18,7 +18,7 @@ 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/{{ smart_executor_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/{{ sis_geotk_dt_plugin_file }} remote_src=yes force=yes notify: Restart smartgears become: True From 7e6dc2efc4d155a8174bae8ab56266e65bf39793 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:16:26 +0200 Subject: [PATCH 06/14] Fix the gcube-oauth role. --- smartgears/gcube-oauth/defaults/main.yml | 1 - smartgears/gcube-oauth/tasks/main.yml | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/smartgears/gcube-oauth/defaults/main.yml b/smartgears/gcube-oauth/defaults/main.yml index 3d609087..6105dad8 100644 --- a/smartgears/gcube-oauth/defaults/main.yml +++ b/smartgears/gcube-oauth/defaults/main.yml @@ -5,5 +5,4 @@ gcube_oauth_name: oauth gcube_oauth_group_id: org.gcube.portal gcube_oauth_extension: war gcube_oauth_file: '{{ gcube_oauth_name }}-{{ gcube_oauth_version }}.{{ gcube_oauth_extension }}' -gcube_oauth_repository_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}' diff --git a/smartgears/gcube-oauth/tasks/main.yml b/smartgears/gcube-oauth/tasks/main.yml index 307c28c0..4eaa112d 100644 --- a/smartgears/gcube-oauth/tasks/main.yml +++ b/smartgears/gcube-oauth/tasks/main.yml @@ -5,19 +5,15 @@ become: True become_user: '{{ d4science_user }}' - when: ( not gcube_oauth_install ) or ( smartgears_upgrade ) + when: not gcube_oauth_install tags: [ 'smartgears', 'gcube_oauth', 'tomcat' ] - block: - # NOTE: Install as the smartgears user so we do not mess with the permissions - name: Get the gcube-oauth war - maven_artifact: artifact_id={{ gcube_oauth_name }} version={{ gcube_oauth_version | default(omit) }} group_id={{ gcube_oauth_group_id }} extension={{ gcube_oauth_extension | default('war') }} repository_url={{ gcube_oauth_repository_url }} dest={{ smartgears_user_home }}/{{ gcube_oauth_file }} + maven_artifact: artifact_id={{ gcube_oauth_name }} version={{ gcube_oauth_version | default(omit) }} group_id={{ gcube_oauth_group_id }} extension={{ gcube_oauth_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ gcube_oauth_file }} - - name: Create the gcube-oauth working directory - file: path={{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} - - - name: Unarchive the gcube_oauth war - unarchive: copy=no src={{ smartgears_user_home }}/{{ gcube_oauth_file }} dest={{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }} creates={{ smartgears_instance_path }}/webapps/{{ gcube_oauth_name }}/WEB-INF/lib + - name: Copy the gcube_oauth war into the webapps directory + copy: src={{ smartgears_downloads_dir }}/{{ gcube_oauth_file }} dest={{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }}.{{ gcube_oauth_extension }} notify: Restart smartgears become: True From c2988484c54cb837e07c1dbf645e8f9cb7869cf9 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:25:35 +0200 Subject: [PATCH 07/14] gcube-oauth: Manage the app removal correctly. --- smartgears/gcube-oauth/tasks/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smartgears/gcube-oauth/tasks/main.yml b/smartgears/gcube-oauth/tasks/main.yml index 4eaa112d..2ca848f8 100644 --- a/smartgears/gcube-oauth/tasks/main.yml +++ b/smartgears/gcube-oauth/tasks/main.yml @@ -1,7 +1,10 @@ --- - block: - name: Remove the old gcube oauth files - file: path={{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }} state=absent + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }}' + - '{{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }}.{{ gcube_oauth_extension }}' become: True become_user: '{{ d4science_user }}' From da6a90513ae9e802f1e525c377ff02b5ca286e8b Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:27:30 +0200 Subject: [PATCH 08/14] accounting-service: Manage the app removal. --- smartgears/accounting-service/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/smartgears/accounting-service/tasks/main.yml b/smartgears/accounting-service/tasks/main.yml index 5deb3f24..eec661f0 100644 --- a/smartgears/accounting-service/tasks/main.yml +++ b/smartgears/accounting-service/tasks/main.yml @@ -1,4 +1,16 @@ --- +- block: + - name: Remove the accounting service app + file: dest={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ accounting_service_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ accounting_service_name }}.{{ accounting_service_extension }}' + + become: True + become_user: '{{ smartgears_user }}' + when: not accounting_service_install + tags: [ 'smartgears', 'accounting_service', 'tomcat' ] + - block: - name: Get the accounting_service war maven_artifact: artifact_id={{ accounting_service_name }} version={{ accounting_service_version | default('latest') }} group_id={{ accounting_service_group_id }} extension={{ accounting_service_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ accounting_service_file }} From 6b4f08e91260d8400d28f33f68102b525d33e9f7 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:33:51 +0200 Subject: [PATCH 09/14] gcube-oauth: Fix the install task. --- smartgears/gcube-oauth/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartgears/gcube-oauth/tasks/main.yml b/smartgears/gcube-oauth/tasks/main.yml index 2ca848f8..6d21b33a 100644 --- a/smartgears/gcube-oauth/tasks/main.yml +++ b/smartgears/gcube-oauth/tasks/main.yml @@ -16,7 +16,7 @@ maven_artifact: artifact_id={{ gcube_oauth_name }} version={{ gcube_oauth_version | default(omit) }} group_id={{ gcube_oauth_group_id }} extension={{ gcube_oauth_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ gcube_oauth_file }} - name: Copy the gcube_oauth war into the webapps directory - copy: src={{ smartgears_downloads_dir }}/{{ gcube_oauth_file }} dest={{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }}.{{ gcube_oauth_extension }} + copy: src={{ smartgears_downloads_dir }}/{{ gcube_oauth_file }} dest={{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }}.{{ gcube_oauth_extension }} remote_src=yes force=yes notify: Restart smartgears become: True From 4461e019f455d90fa75939f5b0debe83880170f4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:36:33 +0200 Subject: [PATCH 10/14] accounting_insert_rstudio_se_plugin: Manage the plugin removal. --- .../accounting_rstudio_se_plugin/tasks/main.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/smartgears/accounting_rstudio_se_plugin/tasks/main.yml b/smartgears/accounting_rstudio_se_plugin/tasks/main.yml index a179b496..700c836e 100644 --- a/smartgears/accounting_rstudio_se_plugin/tasks/main.yml +++ b/smartgears/accounting_rstudio_se_plugin/tasks/main.yml @@ -1,4 +1,16 @@ --- +- block: + - name: Remove the old accounting insert storage plugin + shell: rm -f {{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/{{ accounting_insert_rstudio_se_plugin_maven_artifact_id }}-*-jar-with-dependencies.jar + + - name: Disable the cron job that calculates the home used space + cron: name="Calculate the home used space" special_time=hourly user=root job="/usr/local/bin/calculate_home_space >/dev/null 2>&1" state=absent + + become: True + become_user: '{{ smartgears_user }}' + when: not accounting_insert_rstudio_se_plugin_install + tags: [ 'smartgears', 'accounting_insert_rstudio_se', 'tomcat' ] + - block: - name: Get the accounting insert storage plugin and install it inside the smart executor maven_artifact: artifact_id={{ accounting_insert_rstudio_se_plugin_name }} version={{ accounting_insert_rstudio_se_plugin_version | default(omit) }} group_id={{ accounting_insert_rstudio_se_plugin_group_id }} extension={{ accounting_insert_rstudio_se_plugin_extension | default('war') }} repository_url={{ smartgears_global_base_url }} classifier={{ accounting_insert_rstudio_se_plugin_classifier }} dest={{ smartgears_downloads_dir }}/{{ accounting_insert_rstudio_se_plugin_file }} @@ -17,7 +29,7 @@ become_user: root template: src=calculate_home_space.j2 dest=/usr/local/bin/calculate_home_space mode=0755 owner=root group=root - - name: Install a cron job that runs the calculates the home used space + - name: Install a cron job that calculates the home used space cron: name="Calculate the home used space" special_time=hourly user=root job="/usr/local/bin/calculate_home_space >/dev/null 2>&1" become: True From e38cd4c569c9e8e277bb98923c924d6faf9f26cc Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:37:52 +0200 Subject: [PATCH 11/14] ccounting_insert_storage_se: Manage the app removal. --- .../accounting_insert_storage_se_plugin/tasks/main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/smartgears/accounting_insert_storage_se_plugin/tasks/main.yml b/smartgears/accounting_insert_storage_se_plugin/tasks/main.yml index 82259dbb..076c85f3 100644 --- a/smartgears/accounting_insert_storage_se_plugin/tasks/main.yml +++ b/smartgears/accounting_insert_storage_se_plugin/tasks/main.yml @@ -1,4 +1,13 @@ --- +- block: + - name: Remove the old accounting insert storage plugin + shell: rm -f {{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/{{ accounting_insert_storage_se_plugin_maven_artifact_id }}-*-jar-with-dependencies.jar + + become: True + become_user: '{{ smartgears_user }}' + when: not accounting_insert_storage_se_plugin_install + tags: [ 'smartgears', 'accounting_insert_storage_se', 'tomcat' ] + - block: - name: Get the accounting insert storage plugin and install it inside the smart executor maven_artifact: artifact_id={{ accounting_insert_storage_se_plugin_name }} version={{ accounting_insert_storage_se_plugin_version | default(omit) }} group_id={{ accounting_insert_storage_se_plugin_group_id }} extension={{ accounting_insert_storage_se_plugin_extension | default('war') }} repository_url={{ smartgears_global_base_url }} classifier={{ accounting_insert_storage_se_plugin_classifier }} dest={{ smartgears_downloads_dir }}/{{ accounting_insert_storage_se_plugin_file }} From 604733465e69ac22b5614aea4c81450d76584b46 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:40:17 +0200 Subject: [PATCH 12/14] accounting_aggregator_se_plugin: Manage the app removal. --- .../accounting_aggregator_se_plugin/tasks/main.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/smartgears/accounting_aggregator_se_plugin/tasks/main.yml b/smartgears/accounting_aggregator_se_plugin/tasks/main.yml index 40c3433b..03073e93 100644 --- a/smartgears/accounting_aggregator_se_plugin/tasks/main.yml +++ b/smartgears/accounting_aggregator_se_plugin/tasks/main.yml @@ -1,4 +1,13 @@ --- +- block: + - name: Remove the old accounting aggregator plugin + shell: rm -f {{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/accounting-aggregator-se-plugin-*-jar-with-dependencies.jar + + become: True + become_user: '{{ smartgears_user }}' + when: not accounting_aggregator_se_plugin_install + tags: [ 'smartgears', 'accounting_aggregator_se', 'tomcat' ] + - block: - name: Get the accounting aggregator plugin and install it inside the smart executor maven_artifact: artifact_id={{ accounting_aggregator_se_plugin_name }} version={{ accounting_aggregator_se_plugin_version | default(omit) }} group_id={{ accounting_aggregator_se_plugin_group_id }} extension={{ accounting_aggregator_se_plugin_extension | default('war') }} repository_url={{ smartgears_global_base_url }} classifier={{ accounting_aggregator_se_plugin_classifier }} dest={{ smartgears_downloads_dir }}/{{ accounting_aggregator_se_plugin_file }} @@ -10,8 +19,7 @@ tags: [ 'smartgears', 'accounting_aggregator_se', 'tomcat' ] - name: Copy the accounting aggregator plugin to its final destination - copy: src={{ smartgears_downloads_dir }}/{{ accounting_aggregator_se_plugin_file }} dest={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/{{ accounting_aggregator_se_plugin_file }} remote_src=yes - when: (accounting_aggregator_download | changed) + copy: src={{ smartgears_downloads_dir }}/{{ accounting_aggregator_se_plugin_file }} dest={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib/{{ accounting_aggregator_se_plugin_file }} remote_src=yes force=yes notify: Restart smartgears become: True From 0e94d276ece6e2ab59ab9b85f39d67a46821c5af Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:45:17 +0200 Subject: [PATCH 13/14] catalogue_ws: Convert to maven_artifact properly. --- smartgears/catalogue_ws/defaults/main.yml | 1 - smartgears/catalogue_ws/tasks/main.yml | 30 ++++++++++------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/smartgears/catalogue_ws/defaults/main.yml b/smartgears/catalogue_ws/defaults/main.yml index 6d1d4227..fa8ff209 100644 --- a/smartgears/catalogue_ws/defaults/main.yml +++ b/smartgears/catalogue_ws/defaults/main.yml @@ -1,6 +1,5 @@ --- catalogue_ws_install: False -catalogue_ws_upgrade: False catalogue_ws_version: latest catalogue_ws_name: catalogue-ws diff --git a/smartgears/catalogue_ws/tasks/main.yml b/smartgears/catalogue_ws/tasks/main.yml index 66dfa12f..c53e6ea5 100644 --- a/smartgears/catalogue_ws/tasks/main.yml +++ b/smartgears/catalogue_ws/tasks/main.yml @@ -1,18 +1,22 @@ --- - block: - name: Remove the old catalogue ws files - file: path={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }} state=absent - when: catalogue_ws_upgrade + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }}.{{ catalogue_ws_extension }}' - # NOTE: Install as the smartgears user so we do not mess with the permissions + become: True + become_user: '{{ d4science_user }}' + when: not catalogue_ws_install + tags: [ 'smartgears', 'catalogue_ws', 'tomcat' ] + +- block: - name: Get the catalogue-ws - maven_artifact: artifact_id={{ catalogue_ws_name }} version={{ catalogue_ws_version | default(omit) }} group_id={{ catalogue_ws_group_id }} extension={{ catalogue_ws_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_user_home }}/{{ catalogue_ws_file }} + maven_artifact: artifact_id={{ catalogue_ws_name }} version={{ catalogue_ws_version | default(omit) }} group_id={{ catalogue_ws_group_id }} extension={{ catalogue_ws_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ catalogue_ws_file }} - - name: Create the catalogue ws working directory - file: path={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} - - - name: Unarchive the catalogue ws war - unarchive: copy=no src={{ smartgears_user_home }}/{{ catalogue_ws_file }} dest={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }} creates={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }}/WEB-INF/lib + - name: Copy the catalogue ws war into the tomcat webapps directory + copy: src={{ smartgears_downloads_dir }}/{{ catalogue_ws_file }} dest={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }}.{{ catalogue_ws_extension }} remote_src=yes force=yes notify: Restart smartgears become: True @@ -20,11 +24,3 @@ when: catalogue_ws_install tags: [ 'smartgears', 'catalogue_ws', 'tomcat' ] -- block: - - name: Remove the old catalogue ws files - file: path={{ smartgears_instance_path }}/webapps/{{ catalogue_ws_name }} state=absent - - become: True - become_user: '{{ d4science_user }}' - when: not catalogue_ws_install - tags: [ 'smartgears', 'catalogue_ws', 'tomcat' ] From 71d583d50587c73a41754b1e0af5cbfb2cfb4a4a Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 19:01:11 +0200 Subject: [PATCH 14/14] dm_pool_manager: add the ansible_ppa role as a dependency. Fix the maven_artifact behaviour. --- smartgears/dm_pool_manager/defaults/main.yml | 1 - smartgears/dm_pool_manager/meta/main.yml | 4 ++++ smartgears/dm_pool_manager/tasks/main.yml | 21 +++++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 smartgears/dm_pool_manager/meta/main.yml diff --git a/smartgears/dm_pool_manager/defaults/main.yml b/smartgears/dm_pool_manager/defaults/main.yml index 3b50c268..55a5056a 100644 --- a/smartgears/dm_pool_manager/defaults/main.yml +++ b/smartgears/dm_pool_manager/defaults/main.yml @@ -12,7 +12,6 @@ dm_pool_prod_ghost_instance: 'PROTO_PROD_STAGING_HOST: dataminer-proto-ghost.d4s dm_pool_dev_ghost_instance: 'DEV_STAGING_HOST: dataminer1-devnext.d4science.org' dm_pool_manager_pkgs: - subversion - - 'ansible' dm_pool_svn_url: https://svn.d4science.research-infrastructures.eu:443/gcube/trunk/data-analysis svn_user: svn.d4science diff --git a/smartgears/dm_pool_manager/meta/main.yml b/smartgears/dm_pool_manager/meta/main.yml new file mode 100644 index 00000000..01e77f78 --- /dev/null +++ b/smartgears/dm_pool_manager/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: '../library/roles/ansible_ppa' + diff --git a/smartgears/dm_pool_manager/tasks/main.yml b/smartgears/dm_pool_manager/tasks/main.yml index 98a7e092..eda331c1 100644 --- a/smartgears/dm_pool_manager/tasks/main.yml +++ b/smartgears/dm_pool_manager/tasks/main.yml @@ -1,18 +1,25 @@ --- - block: - name: Remove the old dm_pool_manager files - file: path={{ smartgears_instance_path }}/webapps/{{ dm_pool_manager_name }} state=absent - when: dm_pool_manager_upgrade + file: path={{ item }} state=absent + with_items: + - '{{ smartgears_instance_path }}/webapps/{{ dm_pool_manager_name }}' + - '{{ smartgears_instance_path }}/webapps/{{ dm_pool_manager_name }}.{{ dm_pool_manager_extension }}' + + become: True + become_user: '{{ d4science_user }}' + when: not dm_pool_manager_install + tags: [ 'smartgears', 'dm_pool_manager', 'tomcat' ] + - # NOTE: Install as the smartgears user so we do not mess with the permissions - name: Get the dm_pool_manager - maven_artifact: artifact_id={{ dm_pool_manager_name }} version={{ dm_pool_manager_version | default(omit) }} group_id={{ dm_pool_manager_group_id }} extension={{ dm_pool_manager_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_user_home }}/{{ dm_pool_manager_file }} + maven_artifact: artifact_id={{ dm_pool_manager_name }} version={{ dm_pool_manager_version | default(omit) }} group_id={{ dm_pool_manager_group_id }} extension={{ dm_pool_manager_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ dm_pool_manager_file }} - name: Create the dm_pool_manager working directory file: path={{ smartgears_instance_path }}/webapps/{{ dm_pool_manager_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} - name: Unarchive the dm_pool_manager war - unarchive: copy=no src={{ smartgears_user_home }}/{{ dm_pool_manager_file }} dest={{ smartgears_instance_path }}/webapps/{{ dm_pool_manager_name }} creates={{ smartgears_instance_path }}/webapps/{{ dm_pool_manager_name }}/WEB-INF/lib + unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ dm_pool_manager_file }} dest={{ smartgears_instance_path }}/webapps/{{ dm_pool_manager_name }} creates={{ smartgears_instance_path }}/webapps/{{ dm_pool_manager_name }}/WEB-INF/lib - name: Install the dm-pool-manager web.xml template template: src=web.xml.j2 dest={{ smartgears_instance_path }}/webapps/dataminer-pool-manager/WEB-INF/web.xml mode=0440 @@ -26,10 +33,6 @@ with_items: '{{ tomcat_m_instances }}' notify: Restart smartgears - - name: Install the ansible repository - become_user: root - apt_repository: repo="deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" update_cache=yes state=present - - name: Install the packages required to dm-pool-manager-service become_user: root apt: pkg={{ item }} state=present update_cache=yes cache_valid_time=1800 force=yes