From fc3c424df1d0519247083b3851b49241a7c1c832 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 21 Jun 2016 18:10:15 +0200 Subject: [PATCH] library/roles/ckan/ckan: Insert the plugins list into the CKAN configuration as the last step. d4science-ghn-cluster/group_vars/ckan_prod/ckan_prod.yml: The production portals need to access the CKAN db --- ckan/ckan/defaults/main.yml | 17 +++++++++-------- ckan/ckan/tasks/ckan-config.yml | 7 +++++++ ckan/ckan/tasks/ckan.yml | 2 +- ckan/ckan/tasks/main.yml | 1 + 4 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 ckan/ckan/tasks/ckan-config.yml diff --git a/ckan/ckan/defaults/main.yml b/ckan/ckan/defaults/main.yml index cfed7d9..e0bbb17 100644 --- a/ckan/ckan/defaults/main.yml +++ b/ckan/ckan/defaults/main.yml @@ -82,29 +82,30 @@ apache_additional_modules: - uwsgi ckan_production_ini_opts: - - { section: 'app:main', option: 'ckan.site_id', value: 'd4s_dev', state: 'present' } + - { section: 'app:main', option: 'ckan.site_id', value: 'ckan_installation', 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://{{ ansible_fqdn }}', 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', 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.max_resource_size', value: '10', state: 'present' } + - { section: 'app:main', option: 'ckan.max_image_size', value: '2', 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' } + +ckan_production_ini_plugins_opts: + - { section: 'app:main', option: 'ckan.plugins', value: 'stats text_view image_view recline_view datastore datapusher harvest', 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' } diff --git a/ckan/ckan/tasks/ckan-config.yml b/ckan/ckan/tasks/ckan-config.yml new file mode 100644 index 0000000..b44d21d --- /dev/null +++ b/ckan/ckan/tasks/ckan-config.yml @@ -0,0 +1,7 @@ +--- +- name: Configure the CKAN plugins list into the configuration file + 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_plugins_opts }}' + notify: Restart CKAN + tags: [ 'ckan', 'ckan_ini', 'ckan_plugins' ] + diff --git a/ckan/ckan/tasks/ckan.yml b/ckan/ckan/tasks/ckan.yml index 343b32d..773a71a 100644 --- a/ckan/ckan/tasks/ckan.yml +++ b/ckan/ckan/tasks/ckan.yml @@ -8,7 +8,7 @@ register: ckan_install tags: ckan -- name: Configure the CKAN production configuration file +- 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 with_items: '{{ ckan_production_ini_opts }}' notify: Restart CKAN diff --git a/ckan/ckan/tasks/main.yml b/ckan/ckan/tasks/main.yml index 95db53d..c922927 100644 --- a/ckan/ckan/tasks/main.yml +++ b/ckan/ckan/tasks/main.yml @@ -1,5 +1,6 @@ --- - include: ckan.yml - include: ckan-plugins.yml +- include: ckan-config.yml - include: enable-ckan.yml - include: supervisor.yml