forked from ISTI-ansible-roles/ansible-roles
51 lines
1.9 KiB
YAML
51 lines
1.9 KiB
YAML
---
|
|
- block:
|
|
- name: Install the memcache library deb package
|
|
apt: pkg={{ ckan_memcache_deb_pkgs }} state=present cache_valid_time=1800
|
|
|
|
when: ckan_memcache_sessions is defined and ckan_memcache_sessions
|
|
tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ]
|
|
|
|
- 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: 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 fetch and gather consumers
|
|
register: ckan_use_memcache
|
|
tags: [ 'ckan', 'ckan_ini', 'ckan_plugins', 'ckan_sessions', 'ckan_memcache' ]
|
|
|
|
- name: Restart CKAN after enabling the memcache sessions configuration
|
|
service: name=apache2 state=reloaded
|
|
when: ckan_use_memcache is changed
|
|
|
|
- name: Remove the CKAN session files
|
|
file: dest=/tmp/{{ ckan_site_id }}/sessions state=absent
|
|
ignore_errors: True
|
|
|
|
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' ]
|
|
|
|
when:
|
|
- ckan_memcache_sessions is defined
|
|
- not ckan_memcache_sessions
|
|
tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ]
|
|
|