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' ]