From 970427d280211ab992f243998081f96a8d287f9e Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 29 Sep 2016 15:40:37 +0200 Subject: [PATCH] library/roles/orientdb: Give the possibility to configure the java heap from /etc/default/orientdb. --- orientdb/defaults/main.yml | 3 +++ orientdb/tasks/main.yml | 7 +++++++ orientdb/templates/orientdb.default.j2 | 4 ++++ orientdb/templates/orientdb.init.j2 | 10 +++++++--- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 orientdb/templates/orientdb.default.j2 diff --git a/orientdb/defaults/main.yml b/orientdb/defaults/main.yml index 328229f..c2aae55 100644 --- a/orientdb/defaults/main.yml +++ b/orientdb/defaults/main.yml @@ -33,6 +33,9 @@ orientdb_binary_protocol_higher_port: 2430 orientdb_http_protocol_lower_port: 2480 orientdb_http_protocol_higher_port: 2490 +orientdb_java_heap: '-Xms1024m -Xmx2048m' +orientdb_default_settings: '' + orientdb_distributed: False orientdb_distributed_autodeploy: true orientdb_distributed_writequorum: 'majority' diff --git a/orientdb/tasks/main.yml b/orientdb/tasks/main.yml index 1d40ed8..2791f60 100644 --- a/orientdb/tasks/main.yml +++ b/orientdb/tasks/main.yml @@ -34,6 +34,10 @@ with_items: '{{ orientdb_hooks_jars | default ([]) }}' notify: Restart orientdb + - name: Install the orientdb default settings + template: src=orientdb.default.j2 dest=/etc/default/orientdb owner=root group=root mode=0444 + notify: Restart orientdb + - name: Install the orientdb configuration files template: src={{ item }}.j2 dest={{ orientdb_install_dir }}/config/{{ item }} owner={{ orientdb_user }} group={{ orientdb_user }} mode=0440 with_items: '{{ orientdb_configuration_files }}' @@ -54,6 +58,9 @@ - name: Remove the link to the orientdb distribution file: dest={{ orientdb_home_prefix }}/{{ orientdb_user }}/{{ orientdb_dir }} state=absent + - name: Remove the default options file + file: dest=/etc/default/orientdb state=absent + tags: orientdb when: not orientdb_install diff --git a/orientdb/templates/orientdb.default.j2 b/orientdb/templates/orientdb.default.j2 new file mode 100644 index 0000000..be8a39e --- /dev/null +++ b/orientdb/templates/orientdb.default.j2 @@ -0,0 +1,4 @@ +export ORIENTDB_DIR="{{ orientdb_home_prefix }}/{{ orientdb_user }}/{{ orientdb_dir }}" +export ORIENTDB_USER="{{ orientdb_user }}" +export ORIENTDB_OPTS_MEMORY="{{ orientdb_java_heap }}" +export ORIENTDB_SETTINGS="{{ orientdb_default_settings }}" diff --git a/orientdb/templates/orientdb.init.j2 b/orientdb/templates/orientdb.init.j2 index a84405f..71ea6ad 100755 --- a/orientdb/templates/orientdb.init.j2 +++ b/orientdb/templates/orientdb.init.j2 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # OrientDB service script # # Copyright (c) Orient Technologies LTD (http://www.orientechnologies.com) @@ -8,8 +8,12 @@ # processname: orientdb.sh # You have to SET the OrientDB installation directory here -ORIENTDB_DIR="{{ orientdb_home_prefix }}/{{ orientdb_user }}/{{ orientdb_dir }}" -ORIENTDB_USER="{{ orientdb_user }}" +if [ -f /etc/default/orientdb ] ; then + . /etc/default/orientdb +else + ORIENTDB_DIR="{{ orientdb_home_prefix }}/{{ orientdb_user }}/{{ orientdb_dir }}" + ORIENTDB_USER="{{ orientdb_user }}" +fi usage() { echo "Usage: `basename $0`: "