From 100a2db1141b8e9981ebce0549c98173932d0786 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 31 Mar 2016 13:22:21 +0200 Subject: [PATCH] library/roles/ckan: defaults variables. Add the pip cache directory with the correct permissions. --- ckan/defaults/main.yml | 85 ++++++++++++++++++++++++++++++++++++++++++ ckan/tasks/main.yml | 4 ++ 2 files changed, 89 insertions(+) create mode 100644 ckan/defaults/main.yml diff --git a/ckan/defaults/main.yml b/ckan/defaults/main.yml new file mode 100644 index 00000000..78bf150c --- /dev/null +++ b/ckan/defaults/main.yml @@ -0,0 +1,85 @@ +--- +ckan_version: 2.5 +ckan_deb_file: 'python-ckan_{{ ckan_version }}-{{ ansible_distribution_release }}_amd64.deb' +ckan_package_url: 'http://packaging.ckan.org/{{ ckan_deb_file }}' +ckan_libdir: /usr/lib/ckan +ckan_virtenv: '{{ ckan_libdir }}/default' +ckan_file_storage_dir: /var/lib/ckan/dev +ckan_config_file: /etc/ckan/default/production.ini +ckan_solr_port: 8983 +ckan_shell_user: ckan + +# The order is important +ckan_geonetwork_harvester: True +ckan_ckanext_harvester_url: 'git+https://github.com/ckan/ckanext-harvest.git#egg=ckanext-harvest' +ckan_ckanext_spatial_url: 'git+https://github.com/okfn/ckanext-spatial.git#egg=ckanext-spatial' +ckan_geonetwork_harvester_url: 'https://github.com/geosolutions-it/ckanext-geonetwork.git' +ckan_pdfview: False +ckan_ckanext_pdfview_url: ckanext-pdfview +ckan_privatedatasets: False +ckan_privatedatasets_url: ckanext-privatedatasets +ckan_privatedatasets_name: privatedatasets +ckan_hierarchy: False +ckan_hierarchy_url: 'git+https://github.com/datagovuk/ckanext-hierarchy.git#egg=ckanext-hierarchy' +ckan_hierarchy_name: hierarchy_display hierarchy_form +ckan_pages: False +ckan_pages_url: 'git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages' +ckan_pages_name: pages + +users_system_users: + - { login: '{{ ckan_shell_user }}', name: "CKAN user", home: '/usr/lib', createhome: 'no', ssh_key: '{{ francesco_mangiacrapa }}', shell: '/bin/bash', admin: False, log_as_root: True } + + +# Needed to install some CKAN plugins +additional_packages: + - git + - libxslt1-dev + - gcc + - python-dev + - libxml2-dev + - zlib1g-dev + - libxslt1-dev + - libgeos-c1 + - python-ldap + +ckan_pip_dependencies: + - lxml + - factory +# +apache_additional_packages: + - libapache2-mod-uwsgi + - libpq5 + +apache_additional_modules: + - uwsgi + +ckan_production_ini_opts: + - { section: 'app:main', option: 'ckan.site_id', value: 'd4s_dev', state: 'present' } + - { section: 'app:main', option: 'sqlalchemy.url', value: 'postgresql://{{ ckan_db_user }}:{{ ckan_db_pwd }}@{{ psql_db_host }}/{{ ckan_db_name }}', state: 'present' } + - { section: 'app:main', option: 'ckan.site_url', value: 'http://ckan-d-d4s.d4science.org', state: 'present' } + - { section: 'app:main', option: 'solr_url', value: 'http://127.0.0.1:{{ ckan_solr_port }}/solr', state: 'present' } + - { section: 'app:main', option: 'ckan.datastore.write_url', value: 'postgresql://{{ ckan_db_user }}:{{ ckan_db_pwd }}@{{ psql_db_host }}/{{ ckan_datastore_db_name }}', state: 'present' } + - { section: 'app:main', option: 'ckan.datastore.read_url', value: 'postgresql://{{ ckan_datastore_db_reader }}:{{ ckan_db_pwd }}@{{ psql_db_host }}/{{ ckan_datastore_db_name }}', state: 'present' } +# - { section: 'app:main', option: 'ckan.plugins', value: 'stats text_view image_view recline_view', state: 'present' } + - { section: 'app:main', option: 'ckan.plugins', value: 'stats text_view image_view recline_view datastore datapusher harvest ckan_harvester spatial_metadata spatial_query csw_harvester waf_harvester doc_harvester geonetwork_harvester pdf_view {{ ckan_privatedatasets_name }} {{ ckan_hierarchy_name }} {{ ckan_pages_name }}', state: 'present' } + - { section: 'app:main', option: 'ckan.site_title', value: 'D4Science CKAN development installation', state: 'present' } + - { section: 'app:main', option: 'ckan.site_logo', value: '/base/images/ckan-logo.png', state: 'present' } + - { section: 'app:main', option: 'ckan.datapusher.url', value: 'http://127.0.0.1:8800', state: 'present' } + - { section: 'app:main', option: 'ckan.datapusher.formats', value: 'csv xls xlsx tsv application/csv application/vnd.ms-excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', state: 'present' } + - { section: 'app:main', option: 'ckan.storage_path', value: '{{ ckan_file_storage_dir }}', state: 'present' } + - { section: 'app:main', option: 'ckan.max_resource_size', value: '10', state: 'present' } + - { section: 'app:main', option: 'ckan.max_image_size', value: '2', state: 'present' } + - { section: 'app:main', option: 'ckan.harvest.mq.type', value: 'redis', state: 'present' } + - { section: 'app:main', option: 'ckan.harvest.mq.hostname', value: 'localhost', state: 'present' } + - { section: 'app:main', option: 'ckan.harvest.mq.port', value: '6379', state: 'present' } + - { section: 'app:main', option: 'ckan.harvest.mq.db', value: '0', state: 'present' } + - { section: 'app:main', option: 'ckanext.spatial.search_backend', value: 'solr', state: 'present' } + - { section: 'app:main', option: 'ckan.tracking_enabled', value: 'true', state: 'present' } + - { section: 'app:main', option: 'ckan.privatedatasets.show_acquire_url_on_create', value: 'true', state: 'present' } + - { section: 'app:main', option: 'ckan.privatedatasets.show_acquire_url_on_edit', value: 'true', state: 'present' } + - { section: 'app:main', option: 'ckanext.pages.organization', value: 'true', state: 'present' } + - { section: 'app:main', option: 'ckanext.pages.group', value: 'true', state: 'present' } + - { section: 'app:main', option: 'ckanext.pages.about_menu', value: 'false', state: 'absent' } + - { section: 'app:main', option: 'ckanext.pages.group_menu', value: 'false', state: 'absent' } + - { section: 'app:main', option: 'ckanext.pages.organization_menu', value: 'false', state: 'absent' } + diff --git a/ckan/tasks/main.yml b/ckan/tasks/main.yml index 08bfeea7..2ccec2ac 100644 --- a/ckan/tasks/main.yml +++ b/ckan/tasks/main.yml @@ -35,6 +35,10 @@ when: ( ckan_install | changed ) tags: ckan +- name: Create the pip cache directory with the right permissions + file: dest={{ ckan_libdir }}/.cache owner={{ ckan_shell_user }} group={{ ckan_shell_user }} state=directory + tags: [ 'ckan', '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 }} tags: [ 'ckan', 'ckan_user' ]