ansible-roles/smartgears/resource_registry/tasks/main.yml

43 lines
2.3 KiB
YAML

---
- block:
- name: Remove the old resource-registry files
file: path={{ item }} state=absent
with_items:
- '{{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}'
- '{{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}.{{ resource_registry_extension }}'
notify: Restart smartgears
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_dir }}/{{ resource_registry_file }} verify_checksum=always
register: resource_registry_download
- name: Remove the old resource-registry files
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_download is 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 }}
when: resource_registry_download is changed
- name: Unarchive the resource registry war
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
template: src=config.properties.j2 dest={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}/WEB-INF/classes/config.properties mode=0440
notify: Restart smartgears
become: True
become_user: '{{ d4science_user }}'
tags: [ 'smartgears', 'resource_registry', 'tomcat' ]
when: resource_registry_install