From 0e94d276ece6e2ab59ab9b85f39d67a46821c5af Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 14 Sep 2017 18:45:17 +0200 Subject: [PATCH] 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' ]