smartgears distribution: Use maven_artifact to download the distribution file.

This commit is contained in:
Andrea Dell'Amico 2017-09-27 19:10:37 +02:00
parent 93727c8cac
commit 436c7d6829
2 changed files with 25 additions and 8 deletions

View File

@ -17,9 +17,16 @@ smartgears_downloads_dir: '{{ d4science_user_home }}/downloads'
smartgears_instance_path: '{{ smartgears_user_home }}/tomcat'
smartgears_install_path: '{{ smartgears_user_home }}/SmartGears'
smartgears_distribution_version: 2.1.2-4.6.1-146408
smartgears_file: 'smartgears-distribution-{{ smartgears_distribution_version }}.tar.gz'
#smartgears_file: 'smartgears-distribution-{{ smartgears_distribution_version }}.tar.gz'
smartgears_global_base_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}'
smartgears_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ smartgears_gcube_repository }}/org/gcube/distribution/smartgears-distribution/{{ smartgears_distribution_version }}/{{ smartgears_file }}'
#smartgears_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ smartgears_gcube_repository }}/org/gcube/distribution/smartgears-distribution/{{ smartgears_distribution_version }}/{{ smartgears_file }}'
smartgears_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ smartgears_gcube_repository }}'
smartgears_name: smartgears-distribution
smartgears_group_id: org.gcube.distribution
smartgears_extension: tar.gz
smartgears_file: '{{ smartgears_name }}-{{ smartgears_distribution_version }}.{{ smartgears_extension }}'
smartgears_mode: online
smartgears_application_mode: online
# Production infra

View File

@ -6,25 +6,35 @@
- name: Remove the smartgears distribution archive to force un upgrade
file: dest={{ item }} state=absent
with_items:
- '{{ smartgears_user_home }}/{{ smartgears_file }}'
- '{{ smartgears_downloads_dir }}/{{ smartgears_file }}'
- '{{ smartgears_user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}'
when: smartgears_force_install
tags: [ 'smartgears', 'tomcat' ]
- name: Get the smartgears distribution
become: True
become_user: '{{ smartgears_user }}'
maven_artifact: artifact_id={{ smartgears_name }} version={{ smartgears_distribution_version | default('latest') }} group_id={{ smartgears_group_id }} extension={{ smartgears_extension | default('tar.gz') }} repository_url={{ smartgears_url }} dest={{ smartgears_downloads_dir }}/{{ smartgears_file }}
with_items: '{{ tomcat_m_instances }}'
register: smartgears_download
when: not item.skip_smartgears
tags: [ 'smartgears', 'tomcat' ]
- name: Unarchive the smartgears distribution
become: True
become_user: '{{ smartgears_user }}'
unarchive: copy=no src={{ smartgears_url }} dest={{ smartgears_user_home }} creates={{ smartgears_user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}
register: new_smartgears_distribution
unarchive: remote_src=yes src={{ smartgears_downloads_dir }}/{{ smartgears_file }} dest={{ smartgears_user_home }}
with_items: '{{ tomcat_m_instances }}'
when: not item.skip_smartgears
when:
- not item.skip_smartgears
- ( smartgears_download | changed )
tags: [ 'smartgears', 'tomcat' ]
- name: Stop the smartgears container before launching the upgrade script
become: True
become_user: '{{ smartgears_user }}'
shell: /home/{{ smartgears_user }}/stopContainer.sh
when: smartgears_upgrade
when: smartgears_upgrade or ( smartgears_download | changed )
tags: [ 'smartgears', 'tomcat', 'stop_smartgears_service' ]
- name: Install the additional tomcat default file
@ -46,7 +56,7 @@
shell: cd {{ item.user_home }}/smartgears-distribution-{{ smartgears_distribution_version }} ; . /{{ item.user_home }}/.bashrc ; ./install -s tomcat ; chown -R gcube:gcube '{{ item.user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}' '{{ item.user_home }}/SmartGears/' '{{ item.user_home }}/tomcat/lib/' '{{ item.user_home }}/tomcat/webapps/'
with_items: '{{ tomcat_m_instances }}'
when:
- ( new_smartgears_distribution | changed )
- ( smartgears_download | changed )
- not item.skip_smartgears
register: install_smartgears_app
notify: Restart smartgears