Compare commits

...

8 Commits

4 changed files with 44 additions and 20 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
# ---> Ansible
*.retry
.vscode/settings.json

View File

@ -1,14 +1,11 @@
galaxy_info:
namespace: adellam
role_name: ckan
author: Andrea Dell'Amico
description: Systems Architect
description: Ansible role that installs CKAN, <https://www.ckan.org>, and a bunch of plugins.
company: ISTI-CNR
issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning
license: EUPL 1.2+
min_ansible_version: 2.8
min_ansible_version: "2.8"
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#

View File

@ -1,15 +1,37 @@
---
- block:
- name: Package dependencies
tags: ['ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_pkg_deps']
block:
- name: Install some packages dependencies
apt: name={{ ckan_additional_packages }} state=latest update_cache=yes cache_valid_time=3600
ansible.builtin.apt:
name: "{{ ckan_additional_packages }}"
state: latest
update_cache: true
cache_valid_time: 3600
tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ]
- name: Fix the permissions of "{{ ckan_virtenv }}/src/"
tags: [ckan, ckan_plugins, ckan_src_permissions]
block:
- name: Ensure that everything under "{{ ckan_virtenv }}/src/" is owned by "{{ ckan_shell_user }}"
ansible.builtin.file:
path: "{{ item }}"
state: directory
recurse: true
owner: "{{ ckan_shell_user }}"
group: "{{ ckan_shell_user }}"
loop:
- "/usr/lib/ckan/default/lib/python2.7/site-packages"
- "{{ ckan_virtenv }}/src/"
- block:
- name: CKAN plugins management
become: true
become_user: '{{ ckan_shell_user }}'
tags: ['ckan', 'ckan_plugins']
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 }}'
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
pip: name={{ ckan_pip_dependencies }} virtualenv={{ ckan_virtenv }} state=present
@ -227,19 +249,25 @@
when: ckan_google_analytics | bool
register: install_ckan_google_analytics
notify: Restart CKAN
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_plugins' ]
tags: ['ckan', 'ckan_google_analytics', 'ckan_plugins']
- name: Install the CKAN Google Analytics plugin requirements
pip: requirements={{ ckan_virtenv }}/src/ckanext-googleanalytics/requirements.txt virtualenv={{ ckan_virtenv }} state=present
when: ckan_google_analytics | bool
notify: Restart CKAN
tags: ['ckan', 'ckan_google_analytics', 'ckan_plugins']
- name: Setup the CKAN google analytics plugin
shell: . /usr/lib/ckan/default/bin/activate ; cd /usr/lib/ckan/default/src/ckanext-googleanalytics ; python setup.py develop
when: install_ckan_google_analytics is changed
notify: Restart CKAN
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_plugins' ]
tags: ['ckan', 'ckan_google_analytics', 'ckan_plugins']
- name: Download the CKAN google analytics reports plugin
pip: name='{{ ckan_ga_reports_url }}' virtualenv={{ ckan_virtenv }} state=present editable=True
when: ckan_ga_reports | bool
register: install_ckan_ga_reports
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_ga_reports', 'ckan_plugins' ]
tags: ['ckan', 'ckan_google_analytics', 'ckan_ga_reports', 'ckan_plugins']
- name: Setup the CKAN google analytics reports plugin
shell: . /usr/lib/ckan/default/bin/activate ; cd /usr/lib/ckan/default/src/ckanext-ga-report ; paster initdb --config={{ ckan_config_file }}
@ -247,7 +275,7 @@
- install_ckan_ga_reports is changed
- ckan_init_db_and_solr | bool
notify: Restart CKAN
tags: [ 'ckan', 'ckan_google_analytics', 'ckan_ga_reports', 'ckan_plugins' ]
tags: ['ckan', 'ckan_google_analytics', 'ckan_ga_reports', 'ckan_plugins']
- name: Download the CKAN star ratings plugin
pip: name='{{ ckan_star_ratings_url }}' virtualenv={{ ckan_virtenv }} editable=true state={{ ckan_star_ratings_state }}
@ -287,7 +315,3 @@
when: install_datesearch_plugin is changed
notify: Restart CKAN
tags: [ 'ckan', 'ckan_datesearch', 'ckan_plugins' ]
become: True
become_user: '{{ ckan_shell_user }}'
tags: [ 'ckan', 'ckan_plugins' ]

View File

@ -78,6 +78,8 @@ ckan_pip_dependencies:
- x509
ckan_pip_versioned_dependencies:
- { name: 'wheel', version: '0.37.1', state: 'present' }
- { name: 'setuptools', version: '44.1.1', state: 'present' }
- { name: 'SQLAlchemy', version: '0.9.6', state: 'present' }
- { name: 'cryptography', version: '2.8', state: 'present' }
- { name: 'pyOpenSSL', version: '19', state: 'present' }