The OpenRefine role has its own repository.

This commit is contained in:
Andrea Dell'Amico 2020-06-01 13:16:13 +02:00
parent 6a3f503ac8
commit 755b37c5fe
8 changed files with 173 additions and 70 deletions

View File

@ -1,31 +1,24 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role that installs OpenRefine.
OpenRefine is a free, open source power tool for working with messy data and improving it. <https://openrefine.org/>
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
The list of extensions
``` yaml
openrefine_extensions:
- { url: 'https://github.com/FAIRDataTeam/OpenRefine-metadata-extension/releases/download/v1.4.0/metadata-1.4.0-OpenRefine-3.3.tgz', name: 'metadata' }
- { url: 'https://github.com/stkenny/grefine-rdf-extension/releases/download/v1.2.0-orefine-3.3/rdf-extension-1.2.0-orefine-3.3.zip', name: 'rdf' }
```
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
openjdk
License
-------
@ -35,4 +28,4 @@ EUPL-1.2
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
Andrea Dell'Amico, <andrea.dellamico@isti.cnr.it>

View File

@ -1,2 +1,21 @@
---
# defaults file for ansible-role-template
openrefine_enabled: True
openrefine_major_version: 3
openrefine_minor_version: 3
openrefine_file_extension: 'tar.gz'
openrefine_distribution_prefix: 'openrefine'
openrefine_dist_file: '{{ openrefine_distribution_prefix }}-linux-{{ openrefine_version }}.{{ openrefine_file_extension }}'
openrefine_version: '{{ openrefine_major_version }}.{{ openrefine_minor_version }}'
openrefine_download_url: 'https://github.com/OpenRefine/OpenRefine/releases/download/{{ openrefine_version }}/{{ openrefine_dist_file }}'
openrefine_user: openrefine
openrefine_user_home: /srv/openrefine
openrefine_data_dir: '{{ openrefine_user_home }}/data'
openrefine_log_dir: '{{ openrefine_user_home }}/logs'
openrefine_base_dir: '{{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}'
openrefine_listen_ip: 127.0.0.1
openrefine_http_port: 3333
openrefine_memory: 4192M
openrefine_extensions: []
# - { url: 'https://github.com/FAIRDataTeam/OpenRefine-metadata-extension/releases/download/v1.4.0/metadata-1.4.0-OpenRefine-3.3.tgz', name: 'metadata' }
# - { url: 'https://github.com/stkenny/grefine-rdf-extension/releases/download/v1.2.0-orefine-3.3/rdf-extension-1.2.0-orefine-3.3.zip', name: 'rdf' }

View File

@ -1,2 +1,4 @@
---
# handlers file for ansible-role-template
- name: Restart openrefine
service: name=openrefine state=restarted

View File

@ -1,61 +1,31 @@
galaxy_info:
author: your name
description: your description
author: Andrea Dell'Amico
description: Systems Architect
company: ISTI-CNR
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: EUPL-1.2
license: EUPL 1.2+
min_ansible_version: 2.8
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
platforms:
- name: Ubuntu
versions:
- bionic
- name: EL
versions:
- 7
- 8
galaxy_tags:
- openrefine
dependencies:
- src: git+https://gitea-s2i2s.isti.cnr.it/ISTI-ansible-roles/ansible-role-openjdk.git
version: master
name: openjdk
state: latest

View File

@ -1,2 +1,65 @@
---
# tasks file for ansible-role-template
- block:
- name: Create the openrefine user
user: name={{ openrefine_user }} home={{ openrefine_user_home }} createhome=no shell=/usr/sbin/nologin system=yes
- name: Create the openrefine home, if it does not already exist.
file: dest={{ openrefine_user_home }} owner=root group=root state=directory recurse=yes
- name: Create the openrefine data and logs directories
file: dest={{ item }} owner={{ openrefine_user }} group={{ openrefine_user }} state=directory recurse=yes
with_items:
- '{{ openrefine_data_dir }}'
- '{{ openrefine_log_dir }}'
- name: Download openrefine
unarchive: remote_src=yes src={{ openrefine_download_url }} dest={{ openrefine_user_home }}
args:
creates: '{{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}'
- name: Install the openrefine configuration
template: src=refine.ini dest={{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}/refine.ini owner=root group=root mode=0644
notify: Restart openrefine
tags: [ 'openrefine', 'google_openrefine', 'openrefine_conf' ]
- name: Install the openrefine upstart init script
template: src=openrefine.conf.j2 dest=/etc/init/openrefine.conf owner=root group=root mode=0644
when: ansible_service_mgr != 'systemd'
- name: Install the OpenRefine systemd unit
template: src=openrefine.service.j2 dest=/lib/systemd/system/openrefine.service owner=root group=root mode=0644
register: openrefine_unit_install
- name: Reload the systemd configuration
systemd: daemon_reload=yes
when: openrefine_unit_install is changed
- name: Ensure that the service is running and enabled
service: name=openrefine state=started enabled=yes
when: openrefine_enabled
tags: [ 'openrefine', 'google_openrefine' ]
- block:
- name: Ensure that the service is running and enabled
service: name=openrefine state=stopped enabled=no
when: not openrefine_enabled
tags: [ 'openrefine', 'google_openrefine' ]
- name: Manage OpenRefine extensions
block:
- name: Create the openrefine modules dest directory
file: dest={{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}/webapp/extensions/{{ item.name }} state=directory
with_items: '{{ openrefine_extensions }}'
- name: Download and unpack the openrefine modules
unarchive: src={{ item.url }} remote_src=yes dest={{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}/webapp/extensions/{{ item.name }}
with_items: '{{ openrefine_extensions }}'
args:
creates: '{{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}/webapp/extensions/{{ item.name }}/module'
notify: Restart openrefine
when: openrefine_enabled
tags: [ 'openrefine', 'google_openrefine', 'openrefine_extensions' ]

View File

@ -0,0 +1,13 @@
description "Google OpenRefine server"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
respawn
respawn limit 10 5
setuid {{ openrefine_user }}
setgid {{ openrefine_user }}
script
chdir {{ openrefine_base_dir }}
exec ./refine > {{ openrefine_log_dir }}/openrefine.log 2>&1
end script

View File

@ -0,0 +1,18 @@
[Unit]
Description=OpenRefine
After=network.target
Documentation=https://openrefine.org/
[Service]
WorkingDirectory={{ openrefine_base_dir }}
User={{ openrefine_user }}
Group={{ openrefine_user }}
ExecStart={{ openrefine_base_dir }} -i {{ openrefine_listen_ip }}
NoNewPrivileges=yes
Type=forking
TimeoutStopSec=3600s
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target

25
templates/refine.ini.j2 Normal file
View File

@ -0,0 +1,25 @@
# NOTE: This file is not read if you run the Refine executable directly
# It is only read of you use the refine shell script or refine.bat
no_proxy="localhost,127.0.0.1"
REFINE_PORT={{ openrefine_http_port }}
#REFINE_HOST=127.0.0.1
#REFINE_WEBAPP=main\webapp
# Memory and max form size allocations
#REFINE_MAX_FORM_CONTENT_SIZE=1048576
REFINE_MEMORY={{ openrefine_memory }}
# Set initial java heap space (default: 256M) for better performance with large datasets
REFINE_MIN_MEMORY={{ openrefine_memory }}
# Some sample configurations. These have no defaults.
#ANT_HOME=C:\grefine\tools\apache-ant-1.8.1
#JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
#JAVA_OPTIONS=-XX:+UseParallelGC -verbose:gc -Drefine.headless=true
#JAVA_OPTIONS=-Drefine.data_dir=C:\Users\user\AppData\Roaming\OpenRefine
JAVA_HOME={{ jdk_java_home }}
JAVA_OPTIONS="-server -Djava.awt.headless=true -Dfile.encoding=UTF-8"
# Uncomment to increase autosave period to 60 mins (default: 5 minutes) for better performance of long-lasting transformations
#REFINE_AUTOSAVE_PERIOD=60