311 lines
14 KiB
YAML
311 lines
14 KiB
YAML
---
|
|
- name: Package dependencies
|
|
tags: ['ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps']
|
|
block:
|
|
- name: Install some packages dependencies
|
|
ansible.builtin.apt:
|
|
name: "{{ ckan_additional_packages }}"
|
|
state: latest
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
|
|
- name: Fix the permissions of "{{ ckan_virtenv }}/src/"
|
|
tags: [ckan, ckan_plugins, ckan_src_permissions]
|
|
block:
|
|
- name: Ensure that everything under "{{ ckan_virtenv }}/src/" is owned by "{{ ckan_shell_user }}"
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: "{{ ckan_shell_user }}"
|
|
group: "{{ ckan_shell_user }}"
|
|
loop:
|
|
- "/usr/lib/ckan/default/lib/python2.7/site-packages"
|
|
- "{{ ckan_virtenv }}/src/"
|
|
|
|
- name: CKAN plugins management
|
|
become: true
|
|
become_user: '{{ ckan_shell_user }}'
|
|
tags: ['ckan', 'ckan_plugins']
|
|
block:
|
|
- name: Install some python versioned plugins dependencies inside the CKAN virtualenv
|
|
pip: name={{ item.name }} virtualenv={{ ckan_virtenv }} version={{ item.version }} state={{ item.state }}
|
|
with_items: '{{ ckan_pip_versioned_dependencies }}'
|
|
tags: ['ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps']
|
|
|
|
- name: Install some python plugins dependencies inside the CKAN virtualenv
|
|
pip: name={{ ckan_pip_dependencies }} virtualenv={{ ckan_virtenv }} state=present
|
|
tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ]
|
|
|
|
- name: Download the CKAN ckanext-harvest plugin
|
|
pip: name='{{ ckan_ckanext_harvester_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when: ckan_geonetwork_harvester | bool
|
|
register: ckanext_harvest_install
|
|
notify:
|
|
- Restart CKAN
|
|
- Restart fetch and gather consumers
|
|
ignore_errors: True
|
|
tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN ckanext-harvest requirements
|
|
pip: requirements={{ ckan_virtenv }}/src/ckanext-harvest/pip-requirements.txt virtualenv={{ ckan_virtenv }} state=present
|
|
when: ckan_geonetwork_harvester | bool
|
|
notify: Restart fetch and gather consumers
|
|
tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ]
|
|
|
|
- name: Initialize the CKAN ckanext-harvest plugin
|
|
shell: . /usr/lib/ckan/default/bin/activate ; paster --plugin=ckanext-harvest harvester initdb --config={{ ckan_config_file }}
|
|
when:
|
|
- ckanext_harvest_install is changed
|
|
- ckan_init_db_and_solr | bool
|
|
notify: Restart fetch and gather consumers
|
|
tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN ckanext-spatial plugin
|
|
pip: name='{{ ckan_ckanext_spatial_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
notify: Restart CKAN
|
|
when: ckan_geonetwork_harvester | bool
|
|
register: ckanext_spatial_install
|
|
tags: [ 'ckan', 'ckan_spatial', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN ckanext-spatial requirements
|
|
pip: requirements={{ ckan_virtenv }}/src/ckanext-spatial/pip-requirements.txt virtualenv={{ ckan_virtenv }} state=present
|
|
when: ckan_geonetwork_harvester | bool
|
|
tags: [ 'ckan', 'ckan_spatial', 'ckan_plugins' ]
|
|
|
|
- name: Initialize the CKAN ckanext-spatial plugin
|
|
shell: . /usr/lib/ckan/default/bin/activate ; paster --plugin=ckanext-spatial spatial initdb --config={{ ckan_config_file }}
|
|
when:
|
|
- ckanext_spatial_install is changed
|
|
- ckan_init_db_and_solr | bool
|
|
tags: [ 'ckan', 'ckan_spatial', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN ckanext-geoview plugin
|
|
pip: name='{{ ckan_geoview_url }}' virtualenv={{ ckan_virtenv }} state=present
|
|
notify: Restart CKAN
|
|
when: ckan_geoview | bool
|
|
tags: [ 'ckan', 'ckan_geoview', 'ckan_plugins' ]
|
|
|
|
- name: Download the latest version of the CKAN ckanext-dcat plugin code on CKAN version >= 2.8
|
|
pip: name={{ ckan_dcat_url }} virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when:
|
|
- ckan_dcat | bool
|
|
- ckan_version is version_compare('2.8', '>=')
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_dcat', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN ckanext-dcat plugin code. Stick to version 1.0.0 on CKAN < 2.8
|
|
pip: name={{ ckan_dcat_1_0_0_url }} virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when:
|
|
- ckan_dcat | bool
|
|
- ckan_version is version_compare('2.8', '<')
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_dcat', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN ckanext-dcat requirements
|
|
pip: requirements={{ ckan_virtenv }}/src/ckanext-dcat/requirements.txt virtualenv={{ ckan_virtenv }} state=present
|
|
when: ckan_dcat | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_dcat', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN Geonetwork plugin code
|
|
git: repo={{ ckan_geonetwork_harvester_url }} dest=/usr/lib/ckan/default/src/ckanext-geonetwork force=yes update={{ ckan_git_plugins_state }}
|
|
when: ckan_geonetwork_harvester | bool
|
|
register: install_geonetwork_harvester
|
|
tags: [ 'ckan', 'ckan_geonetwork', 'ckan_plugins' ]
|
|
|
|
- name: Install the CKAN Geonetwork plugin code
|
|
shell: . /usr/lib/ckan/default/bin/activate ; cd /usr/lib/ckan/default/src/ckanext-geonetwork ; python setup.py develop
|
|
when: install_geonetwork_harvester is changed
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_geonetwork', 'ckan_plugins' ]
|
|
|
|
- name: Install the script that updates the tracking data
|
|
template: src=tracker_update.sh.j2 dest={{ ckan_virtenv }}/bin/tracker_update owner={{ ckan_shell_user }} group={{ ckan_shell_user }} mode=0555
|
|
when: ckan_geonetwork_harvester | bool
|
|
tags: ['ckan', 'ckan_geonetwork', 'ckan_plugins', 'tracker', 'ckan_tracker']
|
|
|
|
- name: Install the cron job that runs the tracker update script
|
|
cron:
|
|
name: "tracker update"
|
|
minute: "0"
|
|
hour: "3"
|
|
day: '{{ ckan_gn_harvester_track_cron_day }}'
|
|
job: "{{ ckan_virtenv }}/bin/tracker_update > {{ ckan_logdir }}/tracker_update.log 2>&1"
|
|
user: '{{ ckan_shell_user }}'
|
|
when: ckan_geonetwork_harvester | bool
|
|
tags: ['ckan', 'ckan_geonetwork', 'ckan_plugins', 'tracker', 'ckan_tracker']
|
|
|
|
- name: Download the CKAN PDF viewer plugin
|
|
pip: name='{{ ckan_ckanext_pdfview_url }}' virtualenv={{ ckan_virtenv }} state=present
|
|
when: ckan_pdfview | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_pdfview', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN Privatedatasets extension for CKAN 2.8
|
|
pip: name='{{ ckan_privatedatasets_url }}' virtualenv={{ ckan_virtenv }} state=present
|
|
when:
|
|
- ckan_privatedatasets | bool
|
|
- ckan_version is version_compare('2.8', '>=')
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_privdatasets', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN Privatedatasets extension for CKAN 2.6
|
|
pip: name='{{ ckan_privatedatasets_url }}' virtualenv={{ ckan_virtenv }} state=present version=0.2.19
|
|
when:
|
|
- ckan_privatedatasets | bool
|
|
- ckan_version is version_compare('2.8', '<')
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_privdatasets', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN hierarchy plugin code
|
|
pip: name='{{ ckan_hierarchy_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when: ckan_hierarchy | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_hierarchy', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN pages plugin code
|
|
pip: name='{{ ckan_pages_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when: ckan_pages | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_pages', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN LDAP plugin code
|
|
git: repo={{ ckan_ldap_url }} dest=/usr/lib/ckan/default/src/ckanext-ldap force=yes update={{ ckan_git_plugins_state }}
|
|
when: ckan_ldap | bool
|
|
register: install_ldap_plugin
|
|
tags: [ 'ckan', 'ckan_ldap', 'ckan_plugins' ]
|
|
|
|
- name: Enable the CKAN ldap plugin code
|
|
shell: . /usr/lib/ckan/default/bin/activate ; cd /usr/lib/ckan/default/src/ckanext-ldap ; python setup.py develop
|
|
when: install_ldap_plugin is changed
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_ldap', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN LIRE plugin code
|
|
git: repo={{ ckan_ckanext_lire_url }} dest={{ ckan_virtenv }}/src/ckanext-lire force=yes update={{ ckan_git_plugins_state }}
|
|
when: ckan_ckanext_lire | bool
|
|
register: install_lire_plugin
|
|
tags: [ 'ckan', 'ckan_lire', 'ckan_plugins' ]
|
|
|
|
- name: Activate the CKAN Lire plugin code
|
|
shell: . /usr/lib/ckan/default/bin/activate ; cd {{ ckan_virtenv }}/src/ckanext-lire ; pip install -e ./
|
|
when: install_lire_plugin is changed
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_lire', 'ckan_plugins' ]
|
|
|
|
- name: Download the KATA CKAN OAI-PMH plugin
|
|
pip: name='{{ ckan_oai_pmh_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when: ckan_kata_oai_pmh | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_oai_pmh', 'ckan_plugins' ]
|
|
|
|
- name: Download the KATA CKAN ckanext-oaiphm requirements
|
|
pip: requirements={{ ckan_virtenv }}/src/ckanext-oaipmh/requirements.txt virtualenv={{ ckan_virtenv }} state=present
|
|
when: ckan_kata_oai_pmh | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_oai_pmh', 'ckan_plugins' ]
|
|
|
|
- name: Download the KATA CKAN plugin
|
|
pip: name='{{ ckan_oai_pmh_kata_plugin_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when: ckan_kata_oai_pmh | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_oai_pmh', 'ckan_plugins' ]
|
|
|
|
- name: Download the KATA CKAN requirements
|
|
pip: requirements={{ ckan_virtenv }}/src/ckanext-kata/requirements.txt virtualenv={{ ckan_virtenv }} state=present
|
|
when: ckan_kata_oai_pmh | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_oai_pmh', 'ckan_plugins' ]
|
|
|
|
- name: Download the opendatasoft CKAN OAI-PMH plugin
|
|
pip: name='{{ ckan_oai_pm_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when: ckan_oai_pm | bool
|
|
notify: Restart CKAN
|
|
tags: ['ckan', 'ckan_oai_pm', 'ckan_plugins']
|
|
|
|
- name: Download the CKAN google analytics plugin python requirements
|
|
pip: name='genshi' virtualenv={{ ckan_virtenv }} state=present
|
|
when: ckan_google_analytics | bool
|
|
notify: Restart CKAN
|
|
tags: ['ckan', 'ckan_google_analytics', 'ckan_plugins']
|
|
|
|
- name: Force the removal of the CKAN Google Analytics plugin code
|
|
become_user: root
|
|
file:
|
|
path: /usr/lib/ckan/default/src/ckanext-googleanalytics
|
|
state: absent
|
|
when:
|
|
- ckan_google_analytics | bool
|
|
- ckan_force_google_analytics_upgrade
|
|
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN google analytics plugin
|
|
pip:
|
|
name: '{{ ckan_google_analytics_url }}'
|
|
virtualenv: '{{ ckan_virtenv }}'
|
|
editable: true
|
|
state: '{{ ckan_ga_plugin_state }}'
|
|
when: ckan_google_analytics | bool
|
|
register: install_ckan_google_analytics
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_plugins' ]
|
|
|
|
- name: Setup the CKAN google analytics plugin
|
|
shell: . /usr/lib/ckan/default/bin/activate ; cd /usr/lib/ckan/default/src/ckanext-googleanalytics ; python setup.py develop
|
|
when: install_ckan_google_analytics is changed
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN google analytics reports plugin
|
|
pip: name='{{ ckan_ga_reports_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when: ckan_ga_reports | bool
|
|
register: install_ckan_ga_reports
|
|
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_ga_reports', 'ckan_plugins' ]
|
|
|
|
- name: Setup the CKAN google analytics reports plugin
|
|
shell: . /usr/lib/ckan/default/bin/activate ; cd /usr/lib/ckan/default/src/ckanext-ga-report ; paster initdb --config={{ ckan_config_file }}
|
|
when:
|
|
- install_ckan_ga_reports is changed
|
|
- ckan_init_db_and_solr | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_ga_reports', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN star ratings plugin
|
|
pip: name='{{ ckan_star_ratings_url }}' virtualenv={{ ckan_virtenv }} editable=true state={{ ckan_star_ratings_state }}
|
|
notify: Restart CKAN
|
|
when: ckan_star_ratings | bool
|
|
register: install_ckan_star_ratings
|
|
tags: [ 'ckan', 'ckan_star_ratings', 'ckan_plugins' ]
|
|
|
|
- name: Setup the CKAN star ratings plugin
|
|
shell: . /usr/lib/ckan/default/bin/activate ; paster --plugin=ckanext-rating rating init --config={{ ckan_config_file }}
|
|
notify: Restart CKAN
|
|
when:
|
|
- install_ckan_star_ratings is changed
|
|
- ckan_star_ratings | bool
|
|
tags: [ 'ckan', 'ckan_star_ratings', 'ckan_plugins' ]
|
|
|
|
- name: Install the CKAN profiler plugin
|
|
pip: name='{{ ckan_profiler_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
|
|
when: ckan_profiler | bool
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_profiler', 'ckan_plugins' ]
|
|
|
|
- name: Create the profiler plugin log directory
|
|
become_user: root
|
|
file: dest=/var/log/ckan-profiler owner=www-data group=www-data state=directory
|
|
when: ckan_profiler | bool
|
|
tags: [ 'ckan', 'ckan_profiler', 'ckan_plugins' ]
|
|
|
|
- name: Download the CKAN-DATESEARCH plugin code
|
|
git: repo={{ ckan_datesearch_url }} dest=/usr/lib/ckan/default/src/ckanext-datesearch force=yes update={{ ckan_git_plugins_state }}
|
|
when: ckan_datesearch | bool
|
|
register: install_datesearch_plugin
|
|
tags: [ 'ckan', 'ckan_datesearch', 'ckan_plugins' ]
|
|
|
|
- name: Enable the CKAN-DATESEARCH plugin code
|
|
shell: . /usr/lib/ckan/default/bin/activate ; cd /usr/lib/ckan/default/src/ckanext-datesearch ; python setup.py develop
|
|
when: install_datesearch_plugin is changed
|
|
notify: Restart CKAN
|
|
tags: [ 'ckan', 'ckan_datesearch', 'ckan_plugins' ]
|