sharelatex connector: better use of the maven_artifact plugin.

This commit is contained in:
Andrea Dell'Amico 2017-10-19 19:20:17 +02:00
parent 8ea1f47df8
commit f1280af818
2 changed files with 19 additions and 9 deletions

View File

@ -1,10 +1,8 @@
--- ---
sharelatex_connector_install: False sharelatex_connector_install: False
sharelatex_connector_version: 1.0.0 sharelatex_connector_version: latest
#sharelatex_connector_version: latest
sharelatex_connector_name: sharelatex-connector sharelatex_connector_name: sharelatex-connector
sharelatex_connector_group_id: org.gcube.data.access sharelatex_connector_group_id: org.gcube.data.access
sharelatex_connector_extension: war sharelatex_connector_extension: war
sharelatex_connector_file: '{{ sharelatex_connector_name }}-{{ sharelatex_connector_version }}.{{ sharelatex_connector_extension }}' sharelatex_connector_file: '{{ sharelatex_connector_name }}-{{ sharelatex_connector_version }}.{{ sharelatex_connector_extension }}'
sharelatex_connector_repository_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}'

View File

@ -1,27 +1,39 @@
--- ---
- block: - block:
- name: Remove the old sharelatex-connector files - name: Remove the old sharelatex-connector files
file: path={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }} state=absent file: path={{ item }} state=absent
with_items:
- '{{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }}'
- '{{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }}.{{ sharelatex_connector_extension }}'
become: True become: True
become_user: '{{ d4science_user }}' become_user: '{{ d4science_user }}'
when: ( not sharelatex_connector_install ) or ( smartgears_upgrade ) when: not sharelatex_connector_install
tags: [ 'smartgears', 'sharelatex_connector', 'tomcat' ] tags: [ 'smartgears', 'sharelatex_connector', 'tomcat' ]
- block: - block:
# NOTE: Install as the smartgears user so we do not mess with the permissions
- name: Get the sharelatex-connector war - name: Get the sharelatex-connector war
maven_artifact: artifact_id={{ sharelatex_connector_name }} version={{ sharelatex_connector_version | default(omit) }} group_id={{ sharelatex_connector_group_id }} extension={{ sharelatex_connector_extension | default('war') }} repository_url={{ sharelatex_connector_repository_url }} dest={{ smartgears_user_home }}/{{ sharelatex_connector_file }} maven_artifact: artifact_id={{ sharelatex_connector_name }} version={{ sharelatex_connector_version | default('latest') }} group_id={{ sharelatex_connector_group_id }} extension={{ sharelatex_connector_extension }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ sharelatex_connector_file }}
register: sharelatex_connector_download
- name: Remove the old sharelatex-connector files
file: path={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }} state=absent
when: ( sharelatex_connector_download | changed )
- name: Create the data trasfer working directory - name: Create the sharelatex connector webapp directory
file: path={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} file: path={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }}
- name: Copy the sharelatex_connector war into the webapps directory
copy: src={{ smartgears_downloads_dir }}/{{ sharelatex_connector_file }} dest={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }} remote_src=yes force=yes
notify: Restart smartgears
- name: Unarchive the sharelatex_connector war - name: Unarchive the sharelatex_connector war
unarchive: copy=no src={{ smartgears_user_home }}/{{ sharelatex_connector_file }} dest={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }} creates={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }}/WEB-INF/lib unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ sharelatex_connector_file }} dest={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }} creates={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }}/WEB-INF/lib
notify: Restart smartgears notify: Restart smartgears
- name: Set the sharelatex-connector properties - name: Set the sharelatex-connector properties
template: src=sharelatex-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }}/WEB-INF/web.xml template: src=sharelatex-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/{{ sharelatex_connector_name }}/WEB-INF/web.xml
notify: Restart smartgears
become: True become: True
become_user: '{{ d4science_user }}' become_user: '{{ d4science_user }}'