r-connector: better use of the maven_artifact plugin.

This commit is contained in:
Andrea Dell'Amico 2017-10-19 19:13:06 +02:00
parent 2858824409
commit 8ea1f47df8
2 changed files with 38 additions and 38 deletions

View File

@ -1,12 +1,10 @@
---
gcube_repository: 'gcube-staging'
r_connector_install: False
r_connector_ver: 2.1.3-4.4.0-146364
r_connector_ver: latest
r_connector_name: r-connector
r_connector_group_id: org.gcube.data.analysis
r_connector_extension: war
r_connector_filename: '{{ r_connector_name }}-{{ r_connector_ver }}.{{ r_connector_extension }}'
r_connector_repository_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}'
r_connector_usershome: /home/
r_connector_userconfig: userconfig.csv

View File

@ -3,18 +3,47 @@
- name: Remove the installed R connector before upgrading
file: dest={{ item }} state=absent
with_items:
- '{{ smartgears_instance_path }}/webapps/r-connector'
- '{{ smartgears_instance_path }}/webapps/r-connector.war'
when: smartgears_upgrade
- '{{ smartgears_instance_path }}/webapps/{{ r_connector_name }}'
- '{{ smartgears_instance_path }}/webapps/{{ r_connector_name }}.{{ r_connector_extension }}'
- name: Remove the packages required to enable the LDAP PAM authentication
become: False
apt: pkg={{ item }} state=absent
with_items: '{{ r_connector_deb_pkgs }}'
- name: Remove the connector raddusers script
become: False
file: dest={{ r_connector_adduserscript }} state=absent
- name: Remove the RConfiguration repo
file: dest={{ r_connector_rprofile_path }} state=absent
- name: Remove the cron job that regulary updates the Rprofile
cron: name="Update the RStudioConfiguration repo" job="cd {{ r_connector_rprofile_path }} ; svn update >/dev/null 2>&1" state=absent
become: True
become_user: '{{ smartgears_user }}'
when: not r_connector_install
tags: [ 'smartgears', 'r_connector', 'tomcat' ]
- block:
- name: Get the R Connector war
maven_artifact: artifact_id={{ r_connector_name }} version={{ r_connector_ver | default(omit) }} group_id={{ r_connector_group_id }} extension={{ r_connector_extension | default('war') }} repository_url={{ r_connector_repository_url }} dest={{ smartgears_user_home }}/{{ r_connector_filename }}
maven_artifact: artifact_id={{ r_connector_name }} version={{ r_connector_ver | default('latest') }} group_id={{ r_connector_group_id }} extension={{ r_connector_extension }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ r_connector_filename }}
register: r_connector_download
- name: Remove the installed R connector before upgrading
file: dest={{ smartgears_instance_path }}/webapps/{{ r_connector_name }} state=absent
when: ( r_connector_download | changed )
- name: Create the R connector webapp directory
file: dest={{ smartgears_instance_path }}/webapps/r-connector state=directory
file: dest={{ smartgears_instance_path }}/webapps/{{ r_connector_name }} state=directory
when: ( r_connector_download | changed )
- name: Get and unpack the R connector war file
unarchive: copy=no src={{ smartgears_user_home }}/{{ r_connector_filename }} dest={{ smartgears_instance_path }}/webapps/{{ r_connector_name }}
- name: Copy the R connector war file into the webapps directory
copy: src={{ smartgears_downloads_dir }}/{{ r_connector_filename }} dest={{ smartgears_instance_path }}/webapps/{{ r_connector_name }}.{{ r_connector_extension }} remote_src=yes force=yes
- name: Unarchive the R connector war file
unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ r_connector_filename }} dest={{ smartgears_instance_path }}/webapps/{{ r_connector_name }}
args:
creates: '{{ smartgears_instance_path }}/webapps/{{ r_connector_name }}/WEB-INF/web.xml'
@ -23,7 +52,7 @@
file: dest={{ r_connector_rstudio_cookie_key }} mode=640 group={{ smartgears_user }}
- name: Install the R connector web.xml template
template: src=r-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/r-connector/WEB-INF/web.xml mode=0440
template: src=r-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/{{ r_connector_name }}/WEB-INF/web.xml mode=0440
notify: Restart smartgears
- name: Install the R add users script
@ -85,30 +114,3 @@
- r_connector_install
- r_connector_ldap_enabled
tags: [ 'smartgears', 'r_connector', 'tomcat' ]
- block:
- name: Remove the installed R connector before upgrading
file: dest={{ item }} state=absent
with_items:
- '{{ smartgears_instance_path }}/webapps/r-connector'
- '{{ smartgears_instance_path }}/webapps/r-connector.war'
- name: Remove the packages required to enable the LDAP PAM authentication
become: False
apt: pkg={{ item }} state=absent
with_items: '{{ r_connector_deb_pkgs }}'
- name: Remove the connector raddusers script
become: False
file: dest={{ r_connector_adduserscript }} state=absent
- name: Remove the RConfiguration repo
file: dest={{ r_connector_rprofile_path }} state=absent
- name: Remove the cron job that regulary updates the Rprofile
cron: name="Update the RStudioConfiguration repo" job="cd {{ r_connector_rprofile_path }} ; svn update >/dev/null 2>&1" state=absent
become: True
become_user: '{{ smartgears_user }}'
when: not r_connector_install
tags: [ 'smartgears', 'r_connector', 'tomcat' ]