Fixes to the ckan roles, mostly related to the use of the 'become' directive.

This commit is contained in:
Andrea Dell'Amico 2019-04-11 19:07:25 +02:00
parent 0e3d2f85d6
commit 6a57323aa7
3 changed files with 9 additions and 10 deletions

View File

@ -9,7 +9,7 @@
tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ] tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ]
- block: - block:
- name: Install the memcache library - name: Install the memcache library deb package
apt: pkg=libmemcached10 state=present update_cache=yes cache_valid_time=1800 apt: pkg=libmemcached10 state=present update_cache=yes cache_valid_time=1800
- name: Configure CKAN so that it uses memcache for its sessions - name: Configure CKAN so that it uses memcache for its sessions
@ -27,7 +27,6 @@
file: dest=/tmp/{{ ckan_site_id }}/sessions state=absent file: dest=/tmp/{{ ckan_site_id }}/sessions state=absent
ignore_errors: True ignore_errors: True
become: False
when: ckan_memcache_sessions is defined and ckan_memcache_sessions when: ckan_memcache_sessions is defined and ckan_memcache_sessions
tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ] tags: [ 'ckan', 'ckan_sessions', 'ckan_memcache' ]
@ -40,7 +39,6 @@
- Restart fetch and gather consumers - Restart fetch and gather consumers
tags: [ 'ckan', 'ckan_ini', 'ckan_plugins', 'ckan_sessions', 'ckan_memcache' ] tags: [ 'ckan', 'ckan_ini', 'ckan_plugins', 'ckan_sessions', 'ckan_memcache' ]
become: False
when: when:
- ckan_memcache_sessions is defined - ckan_memcache_sessions is defined
- not ckan_memcache_sessions - not ckan_memcache_sessions

View File

@ -1,10 +1,8 @@
--- ---
- block: - block:
- name: Install some packages dependencies - name: Install some packages dependencies
apt: name={{ item }} state=latest update_cache=yes cache_valid_time=3600 apt: name={{ ckan_additional_packages }} state=latest update_cache=yes cache_valid_time=3600
with_items: '{{ ckan_additional_packages }}'
become: False
tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ] tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ]
- block: - block:
@ -14,8 +12,7 @@
tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ] tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ]
- name: Install some python plugins dependencies inside the CKAN virtualenv - name: Install some python plugins dependencies inside the CKAN virtualenv
pip: name={{ item }} virtualenv={{ ckan_virtenv }} state=present pip: name={{ ckan_pip_dependencies }} virtualenv={{ ckan_virtenv }} state=present
with_items: '{{ ckan_pip_dependencies }}'
tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ] tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ]
- name: Download the CKAN ckanext-harvest plugin - name: Download the CKAN ckanext-harvest plugin
@ -57,7 +54,7 @@
tags: [ 'ckan', 'ckan_spatial', 'ckan_plugins' ] tags: [ 'ckan', 'ckan_spatial', 'ckan_plugins' ]
- name: Download the CKAN ckanext-geoview plugin - name: Download the CKAN ckanext-geoview plugin
pip: name='{{ ckan_geoview_url }}' virtualenv={{ ckan_virtenv }} state={{ ckan_plugins_state }} editable=True pip: name='{{ ckan_geoview_url }}' virtualenv={{ ckan_virtenv }} state={{ ckan_plugins_state }}
notify: Restart CKAN notify: Restart CKAN
when: ckan_geoview when: ckan_geoview
tags: [ 'ckan', 'ckan_geoview', 'ckan_plugins' ] tags: [ 'ckan', 'ckan_geoview', 'ckan_plugins' ]
@ -190,7 +187,7 @@
tags: [ 'ckan', 'ckan_profiler', 'ckan_plugins' ] tags: [ 'ckan', 'ckan_profiler', 'ckan_plugins' ]
- name: Create the profiler plugin log directory - name: Create the profiler plugin log directory
become: False become_user: root
file: dest=/var/log/ckan-profiler owner=www-data group=www-data state=directory file: dest=/var/log/ckan-profiler owner=www-data group=www-data state=directory
when: ckan_profiler when: ckan_profiler
tags: [ 'ckan', 'ckan_profiler', 'ckan_plugins' ] tags: [ 'ckan', 'ckan_profiler', 'ckan_plugins' ]

View File

@ -8,6 +8,10 @@
register: ckan_install register: ckan_install
tags: ckan tags: ckan
- name: Create the CKAN user
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 but 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 }}'