From 159fcdbac298f5e12d7663c2fdf23c67cf48aa7b Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 5 Aug 2016 12:11:40 +0200 Subject: [PATCH] library/roles/ckan/ckan: Add support for the LIRE plugin. More python modules are needed. --- ckan/ckan/defaults/main.yml | 9 ++++++++- ckan/ckan/tasks/ckan-plugins.yml | 21 ++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ckan/ckan/defaults/main.yml b/ckan/ckan/defaults/main.yml index 43994df5..c2e481a2 100644 --- a/ckan/ckan/defaults/main.yml +++ b/ckan/ckan/defaults/main.yml @@ -24,7 +24,7 @@ ckan_logdir: /var/log/ckan ckan_db_name: ckan ckan_db_user: ckan -# The order is important +# Order is important ckan_geonetwork_harvester: False ckan_ckanext_harvester_url: 'git+https://github.com/ckan/ckanext-harvest.git#egg=ckanext-harvest' ckan_ckanext_spatial_url: 'git+https://github.com/okfn/ckanext-spatial.git#egg=ckanext-spatial' @@ -54,6 +54,9 @@ ckan_ldap_username: uid ckan_ldap_email: mail ckan_ldap_prevent_edits: True ckan_ldap_fallback: True +ckan_ckanext_lire: True +ckan_ckanext_lire_n: lire +ckan_ckanext_lire_url: 'https://github.com/milicp/ckanext-lire.git' # Needed to install some CKAN plugins ckan_additional_packages: @@ -61,6 +64,7 @@ ckan_additional_packages: - libxslt1-dev - gcc - python-dev + - libffi-dev - libxml2-dev - zlib1g-dev - libxslt1-dev @@ -73,6 +77,9 @@ ckan_pip_dependencies: - lxml - factory - python-ldap + - rdflib + - 'urllib3[secure]' + - bleach # apache_additional_packages: - libapache2-mod-uwsgi diff --git a/ckan/ckan/tasks/ckan-plugins.yml b/ckan/ckan/tasks/ckan-plugins.yml index f24ca4c6..9963be26 100644 --- a/ckan/ckan/tasks/ckan-plugins.yml +++ b/ckan/ckan/tasks/ckan-plugins.yml @@ -1,16 +1,15 @@ --- - name: Install some packages dependencies + become: False apt: name={{ item }} state=latest update_cache=yes with_items: '{{ ckan_additional_packages }}' - when: ckan_geonetwork_harvester tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ] - name: Install some plugins dependencies inside the CKAN virtualenv become: True become_user: '{{ ckan_shell_user }}' - pip: name={{ item }} virtualenv={{ ckan_virtenv }} + pip: name={{ item }} virtualenv={{ ckan_virtenv }} state=latest with_items: '{{ ckan_pip_dependencies }}' - when: ckan_geonetwork_harvester tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ] - name: Download the CKAN ckanext-harvest plugin @@ -132,3 +131,19 @@ when: ( install_ldap_plugin | changed ) notify: Restart CKAN tags: [ 'ckan', 'ckan_ldap', 'ckan_plugins' ] + +- name: Download the CKAN LIRE plugin code + become: True + become_user: '{{ ckan_shell_user }}' + git: repo={{ ckan_ckanext_lire_url }} dest={{ ckan_virtenv }}/src/ckanext-lire + when: ckan_ckanext_lire + register: install_lire_plugin + tags: [ 'ckan', 'ckan_lire', 'ckan_plugins' ] + +- name: Install the CKAN Geonetwork plugin code + become: True + become_user: '{{ ckan_shell_user }}' + shell: . /usr/lib/ckan/default/bin/activate ; cd {{ ckan_virtenv }}/src/ckanext-lire ; pip install -e ./ + when: ( install_lire_plugin | changed ) + notify: Restart CKAN + tags: [ 'ckan', 'ckan_lire', 'ckan_plugins' ]