Skip to content

Commit

Permalink
Merge pull request #35 from migibert/support_v3
Browse files Browse the repository at this point in the history
Support v3
  • Loading branch information
migibert authored Oct 23, 2019
2 parents 1bd0304 + fa603e4 commit 6007c38
Show file tree
Hide file tree
Showing 12 changed files with 1,481 additions and 484 deletions.
624 changes: 484 additions & 140 deletions README.md

Large diffs are not rendered by default.

496 changes: 409 additions & 87 deletions defaults/main.yml

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions tasks/configure-Debian.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
- stat:
path: /etc/init.d/orientdb
register: service_sysvinit_stat
when: "{{ ansible_distribution_version|int <= 14 }}"

- name: Install orientdb as a sysvinit service
copy:
remote_src: True
src: "{{ orientdb_path }}/bin/orientdb.sh"
dest: /etc/init.d/orientdb
mode: a+x
register: orientdb_sysvinit_unit
when: "{{ ansible_distribution_version|int <= 14 }} and (service_sysvinit_stat.stat.exists == False or orientdb_force_install == True)"
when: ansible_facts.service_mgr == 'sysvinit'

- name: Install orientdb as a systemd service
template:
Expand All @@ -20,15 +15,18 @@
group: root
mode: 400
register: orientdb_systemd_unit
when: "{{ ansible_distribution_version|int > 14 }} or orientdb_force_install == True"
when: ansible_facts.service_mgr == 'systemd'

- name: systemctl daemon-reload
command: systemctl daemon-reload
when: "{{ ansible_distribution_version|int > 14 }} and orientdb_sysvinit_unit|changed"
- name: Reload systemd daemon
systemd :
name: orientdb
enabled: yes
daemon_reload: yes
when: orientdb_service_unit is changed

- name: Launch orientdb service
service:
name: orientdb
state: restarted
enabled: yes
when: (orientdb_sysvinit_unit is defined and orientdb_sysvinit_unit|changed) or (orientdb_systemd_unit and orientdb_systemd_unit|changed) or orientdb_force_install == True
when: (orientdb_sysvinit_unit is defined and orientdb_sysvinit_unit is changed) or (orientdb_systemd_unit and orientdb_systemd_unit is changed) or orientdb_force_install == True
12 changes: 5 additions & 7 deletions tasks/configure-RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
- name: Install orientdb as a systemd service
template:
src: orientdb.service.j2
dest: /usr/lib/systemd/system/orientdb.service
dest: /etc/systemd/system/orientdb.service
owner: root
group: root
mode: 400
register: orientdb_service_unit

- name: systemctl daemon-reload
command: systemctl daemon-reload
when: orientdb_service_unit|changed

- name: Launch orientdb service
service:
- name: Start service
systemd :
name: orientdb
state: restarted
enabled: yes
daemon_reload: yes
when: orientdb_service_unit is changed or orientdb_force_install == True
7 changes: 6 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
file:
path: "{{orientdb_path}}"
owner: "{{orientdb_user}}"
group: "{{orientdb_user}}"
group: "{{orientdb_group}}"
state: directory
recurse: yes

Expand Down Expand Up @@ -58,3 +58,8 @@
template:
src: hazelcast.xml.j2
dest: "{{orientdb_path}}/config/hazelcast.xml"

- name: Configure automatic backup
template:
src: automatic-backup.json.j2
dest: "{{orientdb_path}}/config/automatic-backup.json"
20 changes: 16 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
---
- name: Prerequisites
fail:
msg: Versions 1.x of this role cannot handle OrientDB version > 2 installations.
when: orientdb_version[:1] | int > 2
msg: Versions 1.x of this role cannot handle OrientDB version < 3 installations.
when: orientdb_version[:1] | int < 3

- name: Create orientdb group
group:
name: "{{orientdb_group}}"
state: present

- name: Create orientdb user
user: name={{orientdb_user}} password={{orientdb_user_password}}
user:
name: "{{orientdb_user}}"
password: "{{orientdb_user_password}}"
group: "{{orientdb_group}}"

- name: Create log directory
file: path={{orientdb_log_dir}} state=directory owner={{orientdb_user}} group={{orientdb_user}}
file:
path: "{{orientdb_log_dir}}"
state: directory
owner: "{{orientdb_user}}"
group: "{{orientdb_group}}"

- include: install.yml

Expand Down
13 changes: 13 additions & 0 deletions templates/automatic-backup.json.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"enabled": {% if orientdb_autoback %}true{% else %}false{% endif %},
"mode": "FULL_BACKUP",
"exportOptions": "",
"delay": "{{ orientdb_autoback_delay|default('4h') }}",
"firstTime": "{{ orientdb_autoback_start | default('23:00:00') }}",
"targetDirectory": "backup",
"targetFileName": "${DBNAME}-${DATE:yyyyMMddHHmmss}.zip",
"compressionLevel": 9,
"bufferSize": 1048576,
"dbInclude": {{ orientdb_autoback_db_include | to_json }},
"dbExclude": {{ orientdb_autoback_db_exclude | to_json }}
}
4 changes: 2 additions & 2 deletions templates/default-distributed-db-config.j2
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autoDeploy": {{orientdb_distributed_db_config.autoDeploy | to_json }},
"hotAlignment": {{orientdb_distributed_db_config.hotAlignment | to_json }},
"executionMode": "{{orientdb_distributed_db_config.executionMode}}",
"readQuorum": {{orientdb_distributed_db_config.readQuorum}},
"writeQuorum": {{orientdb_distributed_db_config.writeQuorum}},
"failureAvailableNodesLessQuorum": {{orientdb_distributed_db_config.failureAvailableNodesLessQuorum | to_json}},
"readYourWrites": {{orientdb_distributed_db_config.readYourWrites | to_json}},
"newNodeStrategy": {{orientdb_distributed_db_config.newNodeStrategy | to_json}}
"dataCenters" : {{ orientdb_distributed_db_config.dataCenters | to_json }}
"servers": {{orientdb_distributed_db_config.servers | to_json}},
"clusters": {{orientdb_distributed_db_config.clusters | to_json}}
}
Loading

0 comments on commit 6007c38

Please sign in to comment.