2016-09-23 19:07:39 +02:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
- name: Create the orientdb user
|
2016-09-29 12:48:17 +02:00
|
|
|
user: name={{ orientdb_user }} home={{ orientdb_base_dir }} createhome=yes shell=/bin/bash
|
2016-09-23 19:07:39 +02:00
|
|
|
|
|
|
|
- name: Unpack the orientdb distribution
|
2016-09-29 12:48:17 +02:00
|
|
|
unarchive: src={{ orientdb_binary_distribution_url }} dest={{ orientdb_base_dir }} copy=no
|
2016-09-23 19:07:39 +02:00
|
|
|
args:
|
|
|
|
creates: '{{ orientdb_home_prefix }}/{{ orientdb_user }}/{{ orientdb_dir }}-{{ orientdb_version }}'
|
|
|
|
|
|
|
|
- name: Link to the latest version
|
|
|
|
become: True
|
|
|
|
become_user: '{{ orientdb_user }}'
|
2016-09-29 12:48:17 +02:00
|
|
|
file: src={{ orientdb_dir }}-{{ orientdb_version }} dest={{ orientdb_install_dir }} state=link
|
2016-09-23 19:07:39 +02:00
|
|
|
|
2016-09-27 15:30:41 +02:00
|
|
|
- name: Install the orientdb startup script
|
|
|
|
template: src=orientdb.init.j2 dest=/etc/init.d/orientdb owner=root group=root mode=0755
|
|
|
|
|
|
|
|
- name: Create a orientdb log directory out of the distribution directory
|
2016-09-28 19:19:03 +02:00
|
|
|
file: dest={{ orientdb_log_dir }} state=directory owner={{ orientdb_user }} group={{ orientdb_user }} mode=0755
|
2016-09-27 15:30:41 +02:00
|
|
|
|
2016-09-28 19:19:03 +02:00
|
|
|
- name: Link the log directory inside the orientdb user home
|
|
|
|
become: True
|
|
|
|
become_user: '{{ orientdb_user }}'
|
|
|
|
file: dest={{ orientdb_home_prefix }}/{{ orientdb_user }}/logs src={{ orientdb_log_dir }} state=link
|
|
|
|
|
2016-11-02 15:12:34 +01:00
|
|
|
- name: Create the needed directory inside the orientdb user home
|
2016-09-27 15:30:41 +02:00
|
|
|
become: True
|
|
|
|
become_user: '{{ orientdb_user }}'
|
2016-10-26 16:23:29 +02:00
|
|
|
file: dest={{ item }} state=directory mode=0750
|
|
|
|
with_items:
|
|
|
|
- '{{ orientdb_data_dir }}'
|
|
|
|
- '{{ orientdb_pid_dir }}'
|
2016-11-02 13:10:41 +01:00
|
|
|
- '{{ orientdb_automatic_backup_directory }}'
|
2016-09-28 19:19:03 +02:00
|
|
|
|
2016-10-27 16:10:31 +02:00
|
|
|
- name: Remove the old hook jars
|
2016-11-25 17:28:36 +01:00
|
|
|
shell: rm -f {{ orientdb_install_dir }}/lib/{{ item }}
|
2016-10-27 16:10:31 +02:00
|
|
|
with_items: '{{ orientdb_hooks_to_be_removed | default([]) }}'
|
2016-11-02 12:37:49 +01:00
|
|
|
tags: [ 'orientdb', 'orientdb_hooks' ]
|
2016-10-27 16:10:31 +02:00
|
|
|
|
2016-09-29 12:48:17 +02:00
|
|
|
- name: Fetch and install the hook jars
|
|
|
|
get_url: url='{{ item }}' dest={{ orientdb_install_dir }}/lib
|
2016-10-26 18:48:44 +02:00
|
|
|
with_items: '{{ orientdb_hooks_jars | default([]) }}'
|
2016-09-29 12:48:17 +02:00
|
|
|
notify: Restart orientdb
|
2016-11-02 12:37:49 +01:00
|
|
|
tags: [ 'orientdb', 'orientdb_hooks' ]
|
2016-09-29 12:48:17 +02:00
|
|
|
|
2016-09-29 15:40:37 +02:00
|
|
|
- name: Install the orientdb default settings
|
|
|
|
template: src=orientdb.default.j2 dest=/etc/default/orientdb owner=root group=root mode=0444
|
|
|
|
notify: Restart orientdb
|
|
|
|
|
2016-10-26 16:23:29 +02:00
|
|
|
- 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
|
|
|
|
|
2016-09-28 19:19:03 +02:00
|
|
|
- name: Install the orientdb configuration files
|
2016-10-26 16:23:29 +02:00
|
|
|
template: src={{ item }}.j2 dest={{ orientdb_install_dir }}/config/{{ item }} owner={{ orientdb_user }} group={{ orientdb_user }} mode=0640
|
2016-09-28 19:19:03 +02:00
|
|
|
with_items: '{{ orientdb_configuration_files }}'
|
|
|
|
notify: Restart orientdb
|
2017-02-22 16:41:57 +01:00
|
|
|
tags: [ 'orientdb', 'orientdb_config' ]
|
2016-09-28 19:19:03 +02:00
|
|
|
|
|
|
|
- name: Ensure that the service is enabled and running
|
|
|
|
service: name=orientdb state=started enabled=yes
|
|
|
|
when: orientdb_enabled
|
2016-09-27 15:30:41 +02:00
|
|
|
|
2016-09-23 19:07:39 +02:00
|
|
|
tags: orientdb
|
|
|
|
when: orientdb_install
|
2016-09-28 19:19:03 +02:00
|
|
|
|
2017-02-22 13:33:53 +01:00
|
|
|
- block:
|
|
|
|
- name: Create the acme hooks directory if it does not yet exist
|
|
|
|
file: dest={{ letsencrypt_acme_services_scripts_dir }} state=directory owner=root group=root
|
|
|
|
|
|
|
|
- name: Install a letsencrypt hook to update the orientdb certificate
|
|
|
|
template: src=orientdb-letsencrypt-acme.sh.j2 dest={{ letsencrypt_acme_services_scripts_dir }}/orientdb owner=root group=root mode=4555
|
|
|
|
|
|
|
|
tags: [ 'orientdb', 'letsencrypt' ]
|
|
|
|
when:
|
|
|
|
- orientdb_install
|
|
|
|
- orientdb_letsencrypt_ssl_enabled
|
|
|
|
|
2016-09-28 19:19:03 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Ensure that the service is disabled and stopped
|
|
|
|
service: name=orientdb state=stopped enabled=no
|
|
|
|
|
|
|
|
- name: Remove the link to the orientdb distribution
|
|
|
|
file: dest={{ orientdb_home_prefix }}/{{ orientdb_user }}/{{ orientdb_dir }} state=absent
|
|
|
|
|
2016-09-29 15:40:37 +02:00
|
|
|
- name: Remove the default options file
|
|
|
|
file: dest=/etc/default/orientdb state=absent
|
|
|
|
|
2016-09-28 19:19:03 +02:00
|
|
|
tags: orientdb
|
|
|
|
when: not orientdb_install
|
|
|
|
|