ckan_connector: convert to maven_artifact.

This commit is contained in:
Andrea Dell'Amico 2017-11-24 16:45:20 +01:00
parent 694bf22832
commit b8f7bc795a
2 changed files with 33 additions and 13 deletions

View File

@ -1,9 +1,10 @@
--- ---
ckan_connector_gcube_repository: 'gcube-staging' ckan_connector_gcube_repository: 'gcube-staging'
ckan_connector_plugin_install: False ckan_connector_plugin_install: False
ckan_connector_ver: 1.1.2-4.3.0-142056 ckan_connector_ver: latest
ckan_connector_name: ckan-connector ckan_connector_name: ckan-connector
ckan_connector_filename: '{{ ckan_connector_name }}-{{ ckan_connector_ver }}.war' ckan_connector_extension: war
ckan_connector_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ ckan_connector_gcube_repository }}/org/gcube/data/access/{{ ckan_connector_name }}/{{ ckan_connector_ver}}/{{ ckan_connector_filename }}' ckan_connector_group_id: org.gcube.data.access
ckan_connector_war_file: '{{ ckan_connector_name }}.war' ckan_connector_filename: '{{ ckan_connector_name }}-{{ ckan_connector_ver }}.{{ ckan_connector_extension }}'
ckan_connector_user: ckan_connector ckan_connector_user: ckan_connector

View File

@ -1,29 +1,48 @@
--- ---
- block: - block:
- name: Remove the installed CKAN connector before upgrading - name: Remove the installed CKAN connector
file: dest={{ item }} state=absent file: dest={{ item }} state=absent
with_items: with_items:
- '{{ smartgears_instance_path }}/webapps/ckan-connector' - '{{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}'
- '{{ smartgears_instance_path }}/webapps/ckan-connector.war' - '{{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}.{{ ckan_connector_extension }}'
when: smartgears_upgrade when: smartgears_upgrade
- name: Get the CKAN connector war file - name: Remove the CKAN connector fixer script
get_url: url={{ ckan_connector_url }} dest={{ smartgears_instance_path }}/webapps/{{ ckan_connector_war_file }} become_user: root
file: dest=/usr/local/bin/ckan-connector-fixer state=absent
- name: Unpack the CKAN connector war file become: True
shell: mkdir {{ smartgears_instance_path }}/webapps/ckan-connector ; cd {{ smartgears_instance_path }}/webapps/ckan-connector ; jar xf {{ smartgears_instance_path }}/webapps/{{ ckan_connector_war_file }} become_user: '{{ smartgears_user }}'
when: not ckan_connector_plugin_install
tags: [ 'smartgears', 'ckan', 'ckan_connector', 'tomcat' ]
- block:
- name: Get the CKAN connector war file
maven_artifact: artifact_id={{ ckan_connector_name }} version={{ ckan_connector_ver }} group_id={{ ckan_connector_group_id }} extension={{ ckan_connector_extension }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ ckan_connector_filename }}
register: ckan_connector_download
- name: Remove the installed CKAN connector before upgrading
file: dest={{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }} state=absent
when: ( ckan_connector_download | changed )
- name: Create the CKAN connector webapp directory
file: dest={{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }} state=directory
when: ( ckan_connector_download | changed )
- name: Unarchive the CKAN connector war file
unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ ckan_connector_filename }} dest={{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}
args: args:
creates: '{{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/web.xml' creates: '{{ smartgears_instance_path }}/webapps/{{ ckan_connector_name }}/WEB-INF/web.xml'
- name: Install the CKAN connector web.xml template - name: Install the CKAN connector web.xml template
template: src=ckan-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/.web.xml.tpl mode=0440 template: src=ckan-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/.web.xml.tpl mode=0440
- name: Install the CKAN connector fixer script - name: Install the CKAN connector fixer script
become: False become_user: root
template: src=ckan-connector-fixer.sh.j2 dest=/usr/local/bin/ckan-connector-fixer owner=root group=root mode=0550 template: src=ckan-connector-fixer.sh.j2 dest=/usr/local/bin/ckan-connector-fixer owner=root group=root mode=0550
- name: Fix the CKAN connector web.xml - name: Fix the CKAN connector web.xml
become: False become_user: root
shell: /usr/local/bin/ckan-connector-fixer init shell: /usr/local/bin/ckan-connector-fixer init
args: args:
creates: '{{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/.web.xml.configured' creates: '{{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/.web.xml.configured'