Configure CKAN to use memcached for its sessions. Must set a variable to enable the feature. See https://support.d4science.org/issues/12827

This commit is contained in:
Andrea Dell'Amico 2018-11-20 19:41:53 +01:00
parent 0ac74bb9cf
commit 98ed47284a
3 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,44 @@
---
- block:
- name: Install the memcache library
pip: name=pylibmc virtualenv={{ ckan_virtenv }} state=present
become: True
become_user: '{{ ckan_shell_user }}'
when: ckan_memcache_sessions is defined and ckan_memcache_sessions
tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ]
- block:
- name: Install the memcache library
apt: pkg=libmemcached10 state=present update_cache=yes cache_valid_time=1800
- name: Configure CKAN so that it uses memcache for its sessions
ini_file: dest={{ ckan_config_file }} section={{ item.section }} option={{ item.option }} value={{ item.value }} state={{ item.state }}
with_items: '{{ ckan_memcache_ini_opts }}'
notify:
- Restart CKAN
- Restart fetch and gather consumers
tags: [ 'ckan', 'ckan_ini', 'ckan_plugins', 'ckan_sessions', 'ckan_memcache' ]
- name: Remove the CKAN session files
file: dest=/tmp/{{ ckan_site_id }} state=absent
become: False
when: ckan_memcache_sessions is defined and ckan_memcache_sessions
tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ]
- block:
- name: Configure CKAN to not use memcache for its sessions
ini_file: dest={{ ckan_config_file }} section={{ item.section }} option={{ item.option }} value={{ item.value }} state=absent
with_items: '{{ ckan_memcache_ini_opts }}'
notify:
- Restart CKAN
- Restart fetch and gather consumers
tags: [ 'ckan', 'ckan_ini', 'ckan_plugins', 'ckan_sessions', 'ckan_memcache' ]
become: False
when:
- ckan_memcache_sessions is defined
- not ckan_memcache_sessions
tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ]

View File

@ -1,11 +1,13 @@
---
- block:
- name: Install some packages dependencies
become: False
apt: name={{ item }} state=latest update_cache=yes cache_valid_time=3600
with_items: '{{ ckan_additional_packages }}'
become: False
tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ]
- 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 }}'

View File

@ -1,6 +1,7 @@
---
- import_tasks: ckan.yml
- import_tasks: ckan-plugins.yml
- import_tasks: ckan-memcache.yml
- import_tasks: ckan-config.yml
- import_tasks: enable-ckan.yml
- import_tasks: supervisor.yml