From dfcc84773cf2c7c9fbd0609efaab0fab8ef40b23 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 12 Jun 2017 17:46:09 +0200 Subject: [PATCH] library/roles/smartgears/accounting-service: Converto the accounting-service role to maven_artifact. --- .../accounting-service/defaults/main.yml | 12 +++++------- smartgears/accounting-service/tasks/main.yml | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/smartgears/accounting-service/defaults/main.yml b/smartgears/accounting-service/defaults/main.yml index b66e66b0..32d39f55 100644 --- a/smartgears/accounting-service/defaults/main.yml +++ b/smartgears/accounting-service/defaults/main.yml @@ -1,10 +1,8 @@ --- - -accounting_service_gcube_repository: 'gcube-staging' accounting_service_install: False -accounting_service_ver: 1.0.0-4.5.0-148495 -accounting_service_snap: 1.0.0-SNAPSHOT +accounting_service_upgrade: False +accounting_service_version: 1.0.0-4.5.0-148495 accounting_service_name: accounting-service -accounting_service_filename: '{{ accounting_service_name }}-{{ accounting_service_ver }}.war' -accounting_service_url: 'http://maven.research-infrastructures.eu/nexus/service/local/repositories/{{ accounting_service_gcube_repository }}/content/org/gcube/data/publishing/{{ accounting_service_name }}/{{ accounting_service_ver}}/{{ accounting_service_filename }}' -accounting_service_war_file: '{{ accounting_service_name }}.war' +accounting_service_extension: war +accounting_service_file: '{{ accounting_service_name }}-{{ accounting_service_version }}.{{ accounting_service_extension }}' +accounting_service_group_id: org.gcube.data.publishing diff --git a/smartgears/accounting-service/tasks/main.yml b/smartgears/accounting-service/tasks/main.yml index e76436b4..4a54db7c 100644 --- a/smartgears/accounting-service/tasks/main.yml +++ b/smartgears/accounting-service/tasks/main.yml @@ -1,15 +1,18 @@ --- - block: + - name: Remove the old accounting-service files + file: path={{ smartgears_instance_path }}/webapps/{{ accounting_service_name }} state=absent + when: accounting_service_upgrade - - name: Remove the installed accounting-service before upgrading - file: dest={{ item }} state=absent - with_items: - - '{{ smartgears_instance_path }}/webapps/accounting-service' - - '{{ smartgears_instance_path }}/webapps/accounting-service.war' - when: smartgears_upgrade + - name: Create the accounting-service working directory + file: path={{ smartgears_instance_path }}/webapps/{{ accounting_service_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} + + - 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_user_home }}/{{ accounting_service_file }} - - name: Get the accounting-service war file - get_url: url={{ accounting_service_url }} dest={{ smartgears_instance_path }}/webapps/{{ accounting_service_war_file }} + - name: Unarchive the accounting service war + unarchive: copy=no src={{ smartgears_user_home }}/{{ accounting_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ accounting_service_name }} creates={{ smartgears_instance_path }}/webapps/{{ accounting_service_name }}/WEB-INF/lib + notify: Restart smartgears become: True become_user: '{{ smartgears_user }}'