diff --git a/orientdb/defaults/main.yml b/orientdb/defaults/main.yml index 0e522f6..f66af24 100644 --- a/orientdb/defaults/main.yml +++ b/orientdb/defaults/main.yml @@ -12,6 +12,7 @@ orientdb_home_prefix: /home orientdb_base_dir: '{{ orientdb_home_prefix }}/{{ orientdb_user }}' orientdb_install_dir: '{{ orientdb_base_dir }}/{{ orientdb_dir }}' orientdb_data_dir: '{{ orientdb_home_prefix }}/{{ orientdb_user }}/databases' +orientdb_pid_dir: '{{ orientdb_home_prefix }}/{{ orientdb_user }}/pid' orientdb_configuration_files: - orientdb-server-log.properties - orientdb-server-config.xml @@ -37,10 +38,10 @@ orientdb_java_heap: '-Xms1024m -Xmx2048m' orientdb_default_settings: '' orientdb_distributed: False -orientdb_distributed_autodeploy: true +orientdb_distributed_autodeploy: 'true' orientdb_distributed_writequorum: 'majority' orientdb_distributed_readquorum: 1 -orientdb_distributed_readyourwrites: true +orientdb_distributed_readyourwrites: 'true' orientdb_distributed_executionmode: 'undefined' orientdb_hazelcast_group_name: orientdb orientdb_hazelcast_group_password: orientdb diff --git a/orientdb/tasks/main.yml b/orientdb/tasks/main.yml index 2791f60..2edec3a 100644 --- a/orientdb/tasks/main.yml +++ b/orientdb/tasks/main.yml @@ -27,7 +27,10 @@ - name: Create the databases directory inside the orientdb user home become: True become_user: '{{ orientdb_user }}' - file: dest={{ orientdb_data_dir }} state=directory mode=0750 + file: dest={{ item }} state=directory mode=0750 + with_items: + - '{{ orientdb_data_dir }}' + - '{{ orientdb_pid_dir }}' - name: Fetch and install the hook jars get_url: url='{{ item }}' dest={{ orientdb_install_dir }}/lib @@ -38,8 +41,14 @@ template: src=orientdb.default.j2 dest=/etc/default/orientdb owner=root group=root mode=0444 notify: Restart orientdb + - name: Fix the pid file path inside the start/stop scripts + lineinfile: dest={{ orientdb_install_dir }}/bin/{{ item }} regexp="^ORIENTDB_PID=.*$" line="ORIENTDB_PID={{ orientdb_pid_dir }}/orientdb.pid" + with_items: + - server.sh + - shutdown.sh + - name: Install the orientdb configuration files - template: src={{ item }}.j2 dest={{ orientdb_install_dir }}/config/{{ item }} owner={{ orientdb_user }} group={{ orientdb_user }} mode=0440 + template: src={{ item }}.j2 dest={{ orientdb_install_dir }}/config/{{ item }} owner={{ orientdb_user }} group={{ orientdb_user }} mode=0640 with_items: '{{ orientdb_configuration_files }}' notify: Restart orientdb diff --git a/orientdb/templates/orientdb.default.j2 b/orientdb/templates/orientdb.default.j2 index be8a39e..f77cbc6 100644 --- a/orientdb/templates/orientdb.default.j2 +++ b/orientdb/templates/orientdb.default.j2 @@ -2,3 +2,7 @@ export ORIENTDB_DIR="{{ orientdb_home_prefix }}/{{ orientdb_user }}/{{ orientdb_ export ORIENTDB_USER="{{ orientdb_user }}" export ORIENTDB_OPTS_MEMORY="{{ orientdb_java_heap }}" export ORIENTDB_SETTINGS="{{ orientdb_default_settings }}" +ORIENTDB_SERVER_OPTS= +{% if orientdb_distributed %} +ORIENTDB_SERVER_OPTS="-Ddistributed=true" +{% endif %} \ No newline at end of file diff --git a/orientdb/templates/orientdb.init.j2 b/orientdb/templates/orientdb.init.j2 index 71ea6ad..eefc591 100755 --- a/orientdb/templates/orientdb.init.j2 +++ b/orientdb/templates/orientdb.init.j2 @@ -29,7 +29,7 @@ start() { fi echo "Starting OrientDB server daemon..." cd "$ORIENTDB_DIR/bin" - su $ORIENTDB_USER -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh 1>../log/orientdb.log 2>../log/orientdb.err &" + su $ORIENTDB_USER -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh $ORIENTDB_SERVER_OPTS 1>{{ orientdb_log_dir }}/orientdb.log 2>{{ orientdb_log_dir }}/orientdb.err &" } stop() { @@ -41,7 +41,7 @@ stop() { fi echo "Stopping OrientDB server daemon..." cd "$ORIENTDB_DIR/bin" - su $ORIENTDB_USER -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>../log/orientdb.log 2>>../log/orientdb.err &" + su $ORIENTDB_USER -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>{{ orientdb_log_dir }}/orientdb.log 2>>{{ orientdb_log_dir }}/orientdb.err &" } status() {