Various fixes to the CKAN role.

This commit is contained in:
Andrea Dell'Amico 2019-09-14 16:08:07 +02:00
parent 36149bc631
commit ba0a801b25
4 changed files with 40 additions and 13 deletions

View File

@ -85,6 +85,10 @@ ckan_ga_plugin_state: '{{ ckan_plugins_state }}'
ckan_google_analytics_name: googleanalytics ckan_google_analytics_name: googleanalytics
ckan_google_analytics_url: 'git+https://github.com/ckan/ckanext-googleanalytics.git#egg=ckanext-googleanalytics' ckan_google_analytics_url: 'git+https://github.com/ckan/ckanext-googleanalytics.git#egg=ckanext-googleanalytics'
ckan_google_analytics_fixed_file: 'http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-catalogue/ckan-d4science-extension/{{ ckan_version }}/ckan-default/plugins/googleanalytics/plugin.py' ckan_google_analytics_fixed_file: 'http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-catalogue/ckan-d4science-extension/{{ ckan_version }}/ckan-default/plugins/googleanalytics/plugin.py'
ckan_star_ratings: False
ckan_star_ratings_state: present
ckan_star_ratings_name: rating
ckan_star_ratings_url: 'git+https://github.com/6aika/ckanext-rating.git#egg=ckanext-rating'
ckan_memcache_sessions: False ckan_memcache_sessions: False
ckan_memcache_ini_opts: ckan_memcache_ini_opts:

View File

@ -17,14 +17,17 @@
- name: Download the CKAN ckanext-harvest plugin - name: Download the CKAN ckanext-harvest plugin
pip: name='{{ ckan_ckanext_harvester_url }}' virtualenv={{ ckan_virtenv }} state={{ ckan_plugins_state }} editable=True pip: name='{{ ckan_ckanext_harvester_url }}' virtualenv={{ ckan_virtenv }} state={{ ckan_plugins_state }} editable=True
notify: Restart CKAN
when: ckan_geonetwork_harvester when: ckan_geonetwork_harvester
register: ckanext_harvest_install register: ckanext_harvest_install
notify:
- Restart CKAN
- Restart fetch and gather consumers
tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ] tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ]
- name: Download the CKAN ckanext-harvest requirements - name: Download the CKAN ckanext-harvest requirements
pip: requirements={{ ckan_virtenv }}/src/ckanext-harvest/pip-requirements.txt virtualenv={{ ckan_virtenv }} state={{ ckan_plugins_state }} pip: requirements={{ ckan_virtenv }}/src/ckanext-harvest/pip-requirements.txt virtualenv={{ ckan_virtenv }} state={{ ckan_plugins_state }}
when: ckan_geonetwork_harvester when: ckan_geonetwork_harvester
notify: Restart fetch and gather consumers
tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ] tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ]
- name: Initialize the CKAN ckanext-harvest plugin - name: Initialize the CKAN ckanext-harvest plugin
@ -32,6 +35,7 @@
when: when:
- ckanext_harvest_install is changed - ckanext_harvest_install is changed
- ckan_init_db_and_solr - ckan_init_db_and_solr
notify: Restart fetch and gather consumers
tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ] tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ]
- name: Download the CKAN ckanext-spatial plugin - name: Download the CKAN ckanext-spatial plugin
@ -180,6 +184,21 @@
notify: Restart CKAN notify: Restart CKAN
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_ga_reports', 'ckan_plugins' ] 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
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
tags: [ 'ckan', 'ckan_star_ratings', 'ckan_plugins' ]
- name: Install the CKAN profiler plugin - name: Install the CKAN profiler plugin
pip: name='{{ ckan_profiler_url }}' virtualenv={{ ckan_virtenv }} state={{ ckan_plugins_state }} editable=True pip: name='{{ ckan_profiler_url }}' virtualenv={{ ckan_virtenv }} state={{ ckan_plugins_state }} editable=True
when: ckan_profiler when: ckan_profiler

View File

@ -1,18 +1,17 @@
--- ---
- name: Download the CKAN distribution - name: Download the CKAN distribution
get_url: url='{{ ckan_package_url }}' dest=/srv/{{ ckan_deb_file }} get_url: url='{{ ckan_package_url }}' dest=/srv/{{ ckan_deb_file }} force=yes
tags: ckan tags: [ 'ckan', 'ckan_pkg' ]
- name: Install the CKAN deb package - name: Install the CKAN deb package
apt: deb=/srv/{{ ckan_deb_file }} apt: deb=/srv/{{ ckan_deb_file }}
register: ckan_install register: ckan_install
tags: ckan tags: [ 'ckan', 'ckan_pkg' ]
- name: Create the CKAN user - name: Create the CKAN user
user: name={{ ckan_shell_user }} home={{ ckan_libdir }} createhome=no shell=/usr/sbin/nologin system=yes user: name={{ ckan_shell_user }} home={{ ckan_libdir }} createhome=no shell=/usr/sbin/nologin system=yes
tags: ckan
- name: Configure the CKAN production configuration file but the plugins list - name: Configure the CKAN production configuration file excluding the plugins list
ini_file: dest={{ ckan_config_file }} section={{ item.section }} option={{ item.option }} value={{ item.value }} state={{ item.state }} backup=yes ini_file: dest={{ ckan_config_file }} section={{ item.section }} option={{ item.option }} value={{ item.value }} state={{ item.state }} backup=yes
with_items: '{{ ckan_production_ini_opts }}' with_items: '{{ ckan_production_ini_opts }}'
notify: Restart CKAN notify: Restart CKAN
@ -21,7 +20,7 @@
- name: Install the apache.wsgi - name: Install the apache.wsgi
template: src=apache.wsgi.j2 dest={{ ckan_confdir }}/apache.wsgi template: src=apache.wsgi.j2 dest={{ ckan_confdir }}/apache.wsgi
notify: Restart CKAN notify: Restart CKAN
tags: [ 'ckan', 'apache' ] tags: [ 'ckan', 'apache', 'ckan_pkg' ]
- name: Create the base directory for the CKAN file storage - name: Create the base directory for the CKAN file storage
file: dest={{ ckan_file_storage_dir }} state=directory owner={{ apache_user }} group={{ ckan_shell_user }} mode=2770 file: dest={{ ckan_file_storage_dir }} state=directory owner={{ apache_user }} group={{ ckan_shell_user }} mode=2770
@ -36,11 +35,17 @@
when: psql_db_host != 'localhost' when: psql_db_host != 'localhost'
tags: [ 'pg_backup', 'postgresql', 'postgres' ] tags: [ 'pg_backup', 'postgresql', 'postgres' ]
- name: Initialize the CKAN databases - name: Initialize the CKAN database
shell: ckan db init ; ckan datastore set-permissions | psql --set ON_ERROR_STOP=1 -h {{ psql_db_host }} -U {{ ckan_db_user }} -w {{ ckan_datastore_db_name }} ; touch {{ ckan_libdir }}/.ckan_db_initialized shell: ckan db init && touch {{ ckan_libdir }}/.ckan_db_initialized
args: args:
creates: '{{ ckan_libdir }}/.ckan_db_initialized' creates: '{{ ckan_libdir }}/.ckan_db_initialized'
ignore_errors: True when: ckan_init_db_and_solr
tags: ckan
- name: Initialize the CKAN datastore database
shell: ckan datastore set-permissions | psql --set ON_ERROR_STOP=1 -h {{ psql_db_host }} -U {{ ckan_db_user }} -w {{ ckan_datastore_db_name }} && touch {{ ckan_libdir }}/.ckan_datastore_db_initialized
args:
creates: '{{ ckan_libdir }}/.ckan_datastore_db_initialized'
when: ckan_init_db_and_solr when: ckan_init_db_and_solr
tags: ckan tags: ckan
@ -50,7 +55,7 @@
- name: Assign the CKAN virtenv dir to the ckan user - name: Assign the CKAN virtenv dir to the ckan user
file: dest={{ ckan_virtenv }} recurse=yes owner={{ ckan_shell_user }} group={{ ckan_shell_user }} file: dest={{ ckan_virtenv }} recurse=yes owner={{ ckan_shell_user }} group={{ ckan_shell_user }}
tags: [ 'ckan', 'ckan_user' ] tags: [ 'ckan', 'ckan_user', 'ckan_permissions' ]
- name: Create a log directory for the jobs run by the ckan user - name: Create a log directory for the jobs run by the ckan user
file: dest={{ ckan_logdir }} state=directory owner={{ ckan_shell_user }} group={{ ckan_shell_user }} file: dest={{ ckan_logdir }} state=directory owner={{ ckan_shell_user }} group={{ ckan_shell_user }}

View File

@ -1,7 +1,6 @@
--- ---
- name: Install the supervisor daemon needed to automate the gather and fetch operations - name: Install the supervisor daemon needed to automate the gather and fetch operations
apt: pkg={{ item }} state=present apt: pkg={{ ckan_gather_fetch_pkgs }} state=present
with_items: '{{ ckan_gather_fetch_pkgs }}'
tags: [ 'ckan', 'ckan_harvest' ] tags: [ 'ckan', 'ckan_harvest' ]
- name: Install the gather and fetch supervisor configuration - name: Install the gather and fetch supervisor configuration