resource_registry: refactor to make a better use of resource_registry.

This commit is contained in:
Andrea Dell'Amico 2017-10-19 18:06:33 +02:00
parent 54b61f7f28
commit 882d486451
1 changed files with 24 additions and 5 deletions

View File

@ -1,17 +1,36 @@
---
- block:
- name: Remove the old resource-registry files
file: path={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} state=absent
file: path={{ item }} state=absent
with_items:
- '{{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}'
- '{{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}.{{ resource_registry_extension }}'
when: resource_registry_upgrade
become: True
become_user: '{{ d4science_user }}'
tags: [ 'smartgears', 'resource_registry', 'tomcat' ]
when: not resource_registry_install
- block:
- name: Get the resource_registry war
maven_artifact: artifact_id={{ resource_registry_name }} version={{ resource_registry_version | default('latest') }} group_id={{ resource_registry_group_id }} extension={{ resource_registry_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_directory }}/{{ resource_registry_file }}
register: resource_registry_download
- name: Remove the old resource-registry files
file: path={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} state=absent
when: ( resource_registry_download | changed )
- name: Create the resource-registry working directory
file: path={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }}
- name: Get the resource_registry war
maven_artifact: artifact_id={{ resource_registry_name }} version={{ resource_registry_version | default('latest') }} group_id={{ resource_registry_group_id }} extension={{ resource_registry_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_user_home }}/{{ resource_registry_file }}
when: ( resource_registry_download | changed )
- name: Copy the resource registry war file into the webapps directory
copy: src={{ smartgears_downloads_dir }}/{{ resource_registry_file }} dest={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}.{{ resource_registry_extension }} remote_src=yes force=yes
notify: Restart smartgears
- name: Unarchive the resource registry war
unarchive: copy=no src={{ smartgears_user_home }}/{{ resource_registry_file }} dest={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} creates={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}/WEB-INF/lib
unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ resource_registry_file }} dest={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} creates={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}/WEB-INF/lib
notify: Restart smartgears
- name: Install the resource registry configuration