Skip to content
This repository was archived by the owner on Mar 20, 2021. It is now read-only.

Commit cf0a872

Browse files
committed
Added all setup
1 parent b38e269 commit cf0a872

File tree

11 files changed

+951
-71
lines changed

11 files changed

+951
-71
lines changed

README.md

+31-12
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,57 @@
1-
Role Name
2-
=========
1+
adriagalin.neo4j
2+
================
33

4-
A brief description of the role goes here.
4+
[![Build Status](https://travis-ci.org/adriagalin/ansible.neo4j.svg?branch=master)](https://travis-ci.org/adriagalin/ansible.neo4j) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-neo4j-blue.svg)](https://galaxy.ansible.com/list#/roles/NUM)
5+
6+
An ansible role for set up a Neo4j graph database server.
57

68
Requirements
79
------------
810

9-
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.
11+
Tested on:
12+
13+
- Ubuntu 14.04 LTS
14+
- Ubuntu 16.04 LTS
15+
16+
Should work with:
17+
18+
- All Ubuntu
19+
- All Debian
1020

1121
Role Variables
1222
--------------
1323

14-
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.
24+
Check defaults/main.yml file to review all vars.
1525

1626
Dependencies
1727
------------
1828

19-
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.
29+
None.
2030

2131
Example Playbook
2232
----------------
2333

24-
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
25-
26-
- hosts: servers
34+
```yaml
35+
- hosts: all
2736
roles:
28-
- { role: username.rolename, x: 42 }
37+
- { role: adriagalin.neo4j }
2938

3039
License
3140
-------
3241

33-
BSD
42+
GPLv3 License.
3443

3544
Author Information
3645
------------------
3746

38-
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
47+
[Adrià Galín](https://www.adriagalin.com/)
48+
49+
Inspiration
50+
-----------
51+
52+
During development, some roles in Ansible Galaxy/Github also inspired me:
53+
54+
- [julienroubieu](https://github.com/julienroubieu/ansible-neo4j)
55+
- and many others.
56+
57+
thank you.

defaults/main.yml

+133-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,134 @@
11
---
2-
# defaults file for adriagalin.neo4j
2+
# defaults file for adriagalin.neo4j
3+
ag_neo4j_package: neo4j
4+
ag_neo4j_package_version: 3.2.3
5+
ag_neo4j_repository_key: 'https://debian.neo4j.org/neotechnology.gpg.key'
6+
ag_neo4j_repository: 'deb http://debian.neo4j.org/repo stable/'
7+
8+
ag_neo4j_owner: neo4j
9+
ag_neo4j_group: adm
10+
ag_neo4j_mode: 0644
11+
12+
ag_neo4j_java_install: true
13+
ag_neo4j_java_package: openjdk-8-jdk-headless
14+
15+
# Limits
16+
ag_neo4j_update_limits: true
17+
ag_neo4j_nofile_value: 40000
18+
19+
# Neo4j plugins list
20+
ag_neo4j_plugins: []
21+
22+
ag_neo4j_ansible_managed: "# Ansible managed configuration. Don't touch manually."
23+
#*****************************************************************
24+
# Neo4j configuration
25+
#*****************************************************************
26+
ag_neo4j_template_path: etc/neo4j/neo4j.conf.j2
27+
ag_neo4j_configuration_destination: /etc/neo4j/neo4j.conf
28+
29+
ag_neo4j_dbms_active_database: 'graph.db'
30+
31+
ag_neo4j_dbms_directories_data: '/var/lib/neo4j/data'
32+
ag_neo4j_dbms_directories_plugins: '/var/lib/neo4j/plugins'
33+
ag_neo4j_dbms_directories_certificates: '/var/lib/neo4j/certificates'
34+
ag_neo4j_dbms_directories_logs: '/var/log/neo4j'
35+
ag_neo4j_dbms_directories_lib: '/usr/share/neo4j/lib'
36+
ag_neo4j_dbms_directories_run: '/var/run/neo4j'
37+
ag_neo4j_dbms_directories_import: '/var/lib/neo4j/import'
38+
39+
# ag_neo4j_dbms_security_auth_enabled: false
40+
# ag_neo4j_dbms_allow_format_migration: true
41+
42+
# ag_neo4j_dbms_memory_heap_initial_size: '512m'
43+
# ag_neo4j_dbms_memory_heap_max_size: '512m'
44+
# ag_neo4j_dbms_memory_pagecache_size: 10g
45+
46+
#*****************************************************************
47+
# Network connector configuration
48+
#*****************************************************************
49+
# ag_neo4j_dbms_connectors_default_listen_address: 0.0.0.0
50+
# ag_neo4j_dbms_connectors_default_advertised_address: localhost
51+
52+
ag_neo4j_dbms_connector_bolt_enabled: true
53+
ag_neo4j_dbms_connector_bolt_tls_level: 'OPTIONAL'
54+
ag_neo4j_dbms_connector_bolt_listen_address: ':7687'
55+
56+
ag_neo4j_dbms_connector_http_enabled: true
57+
#ag_neo4j_dbms_connector_http_listen_address: ':7474'
58+
59+
ag_neo4j_dbms_connector_https_enabled: true
60+
# ag_neo4j_dbms_connector_https_listen_address: ':7473'
61+
62+
# ag_neo4j_dbms_threads_worker_count:
63+
64+
#*****************************************************************
65+
# SSL system configuration
66+
#*****************************************************************
67+
# ag_neo4j_bolt_ssl_policy: 'legacy'
68+
# ag_neo4j_https_ssl_policy: 'legacy'
69+
70+
#*****************************************************************
71+
# SSL policy configuration
72+
#*****************************************************************
73+
# ag_neo4j_dbms_ssl_policy_default_base_directory: 'certificates/default'
74+
# ag_neo4j_dbms_ssl_policy_default_allow_key_generation: false
75+
# ag_neo4j_dbms_ssl_policy_default_trust_all: false
76+
# ag_neo4j_dbms_ssl_policy_default_private_key: ''
77+
# ag_neo4j_dbms_ssl_policy_default_public_key: ''
78+
# ag_neo4j_dbms_ssl_policy_default_trusted_dir: ''
79+
# ag_neo4j_dbms_ssl_policy_default_client_auth: 'require'
80+
# ag_neo4j_dbms_ssl_policy_default_tls_versions: ''
81+
# ag_neo4j_dbms_ssl_policy_default_ciphers: ''
82+
83+
#*****************************************************************
84+
# Logging configuration
85+
#*****************************************************************
86+
# ag_neo4j_dbms_logs_http_enabled: true
87+
# ag_neo4j_dbms_logs_http_rotation_keep_number: 5
88+
# ag_neo4j_dbms_logs_http_rotation_size: '20m'
89+
# ag_neo4j_dbms_logs_gc_enabled: true
90+
# ag_neo4j_dbms_logs_gc_options: '-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintPromotionFailure -XX:+PrintTenuringDistribution'
91+
# ag_neo4j_dbms_logs_gc_rotation_keep_number: 5
92+
# ag_neo4j_dbms_logs_gc_rotation_size: '20m'
93+
# ag_neo4j_dbms_logs_debug_rotation_size: '20m'
94+
# ag_neo4j_dbms_logs_debug_rotation_keep_number: 7
95+
96+
#*****************************************************************
97+
# Miscellaneous configuration
98+
#*****************************************************************
99+
# ag_neo4j_cypher_default_language_version: '3.0'
100+
# ag_neo4j_dbms_security_allow_csv_import_from_file_urls: true
101+
ag_neo4j_dbms_tx_log_rotation_retention_policy: '1 days'
102+
# ag_neo4j_dbms_shell_enabled: true
103+
# ag_neo4j_dbms_shell_host: '127.0.0.1'
104+
# ag_neo4j_dbms_shell_port: 1337
105+
# ag_neo4j_dbms_read_only: false
106+
# ag_neo4j_dbms_unmanaged_extension_classes: 'org.neo4j.examples.server.unmanaged=/examples/unmanaged'
107+
108+
#********************************************************************
109+
# JVM Parameters
110+
#********************************************************************
111+
ag_neo4j_dbms_jvm_additional:
112+
- '-XX:+UseG1GC -XX:-OmitStackTraceInFastThrow'
113+
- '-XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions'
114+
- '-XX:+TrustFinalNonStaticFields'
115+
- '-XX:+DisableExplicitGC'
116+
# - '-Djava.rmi.server.hostname=$THE_NEO4J_SERVER_HOSTNAME'
117+
- '-Djdk.tls.ephemeralDHKeySize=2048'
118+
ag_neo4j_dbms_jvm_additional_remote: []
119+
# - '-Dcom.sun.management.jmxremote.port=3637'
120+
# - '-Dcom.sun.management.jmxremote.authenticate=true'
121+
# - '-Dcom.sun.management.jmxremote.ssl=false'
122+
# - '-Dcom.sun.management.jmxremote.password.file=/absolute/path/to/conf/jmx.password'
123+
# - '-Dcom.sun.management.jmxremote.access.file=/absolute/path/to/conf/jmx.access'
124+
125+
#********************************************************************
126+
# Wrapper Windows NT/2000/XP Service Properties
127+
#********************************************************************
128+
ag_neo4j_dbms_windows_service_name: 'neo4j'
129+
130+
#********************************************************************
131+
# Other Neo4j system properties
132+
#********************************************************************
133+
ag_neo4j_dbms_jvm_additional_others:
134+
- '-Dunsupported.dbms.udc.source=debian'

handlers/main.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
---
2-
# handlers file for adriagalin.neo4j
2+
# handlers file for adriagalin.neo4j
3+
4+
- name: neo4j | restart
5+
service:
6+
name: neo4j
7+
state: restarted

meta/main.yml

+17-56
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,18 @@
11
galaxy_info:
2-
author: your name
3-
description: your description
4-
company: your company (optional)
5-
6-
# If the issue tracker for your role is not on github, uncomment the
7-
# next line and provide a value
8-
# issue_tracker_url: http://example.com/issue/tracker
9-
10-
# Some suggested licenses:
11-
# - BSD (default)
12-
# - MIT
13-
# - GPLv2
14-
# - GPLv3
15-
# - Apache
16-
# - CC-BY
17-
license: license (GPLv2, CC-BY, etc)
18-
19-
min_ansible_version: 1.2
20-
21-
# If this a Container Enabled role, provide the minimum Ansible Container version.
22-
# min_ansible_container_version:
23-
24-
# Optionally specify the branch Galaxy will use when accessing the GitHub
25-
# repo for this role. During role install, if no tags are available,
26-
# Galaxy will use this branch. During import Galaxy will access files on
27-
# this branch. If Travis integration is configured, only notifications for this
28-
# branch will be accepted. Otherwise, in all cases, the repo's default branch
29-
# (usually master) will be used.
30-
#github_branch:
31-
32-
#
33-
# platforms is a list of platforms, and each platform has a name and a list of versions.
34-
#
35-
# platforms:
36-
# - name: Fedora
37-
# versions:
38-
# - all
39-
# - 25
40-
# - name: SomePlatform
41-
# versions:
42-
# - all
43-
# - 1.0
44-
# - 7
45-
# - 99.99
46-
47-
galaxy_tags: []
48-
# List tags for your role here, one per line. A tag is a keyword that describes
49-
# and categorizes the role. Users find roles by searching for tags. Be sure to
50-
# remove the '[]' above, if you add tags to this list.
51-
#
52-
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
53-
# Maximum 20 tags per role.
54-
55-
dependencies: []
56-
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
57-
# if you add dependencies to this list.
2+
author: Adria Galin Figueras
3+
description: Install and configure Neo4j on your systems.
4+
company: Adria Galin
5+
license: GPLv3
6+
min_ansible_version: 2.0
7+
platforms:
8+
- name: Ubuntu
9+
versions:
10+
- all
11+
- name: Debian
12+
versions:
13+
- all
14+
galaxy_tags:
15+
- neo4j
16+
- db
17+
- databeses
18+
dependencies: []

tasks/java.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
# tasks file for adriagalin.neo4j
3+
4+
- name: neo4j | install java package
5+
apt:
6+
name: "{{ ag_neo4j_java_package }}"
7+
state: present
8+
install_recommends: yes
9+
update_cache: yes

tasks/limits.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
# tasks file for adriagalin.neo4j
3+
4+
- name: neo4j | set limits (nofile soft and hard limit)
5+
lineinfile:
6+
dest: /etc/security/limits.conf
7+
regexp: "{{ item.regexp }}"
8+
line: "{{ item.line }}"
9+
insertbefore: "# End of file"
10+
state: present
11+
with_items:
12+
- { regexp: '^{{ ag_neo4j_owner }}\s+soft', line: '{{ ag_neo4j_owner }} soft nofile {{ ag_neo4j_nofile_value }}' }
13+
- { regexp: '^{{ ag_neo4j_owner }}\s+hard', line: '{{ ag_neo4j_owner }} hard nofile {{ ag_neo4j_nofile_value }}' }
14+
when: ag_neo4j_update_limits

tasks/main.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
---
2-
# tasks file for adriagalin.neo4j
2+
# tasks file for adriagalin.neo4j
3+
4+
- include: java.yml
5+
when: ag_neo4j_java_install
6+
tags: [ java ]
7+
8+
- include: neo4j.yml
9+
tags: [ neo4j ]
10+
11+
- include: plugins.yml
12+
when: ag_neo4j_plugins|length > 0
13+
tags: [ neo4j, neo4j-plugins ]

tasks/neo4j.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# tasks file for adriagalin.neo4j
3+
4+
- name: neo4j | add neo4j repository apt-key
5+
apt_key:
6+
url: "{{ ag_neo4j_repository_key }}"
7+
state: present
8+
9+
- name: neo4j | add neo4j repository
10+
apt_repository:
11+
repo: "{{ ag_neo4j_repository }}"
12+
state: present
13+
update_cache: yes
14+
15+
- name: neo4j | install the neo4j package
16+
apt:
17+
name: neo4j={{ ag_neo4j_package_version }}
18+
state: present
19+
install_recommends: yes
20+
update_cache: yes
21+
22+
- name: neo4j | set user
23+
user: name={{ ag_neo4j_owner }} state=present
24+
25+
- name: neo4j | configure neo4j
26+
template:
27+
src: "{{ ag_neo4j_template_path }}"
28+
dest: "{{ ag_neo4j_configuration_destination }}"
29+
owner: "{{ ag_neo4j_owner }}"
30+
group: "{{ ag_neo4j_group }}"
31+
mode: "{{ ag_neo4j_mode }}"
32+
notify: neo4j | restart
33+
34+
- include: limits.yml
35+
36+
- name: neo4j | ensure neo4j is enabled and started
37+
service:
38+
name: neo4j
39+
enabled: yes
40+
state: started

tasks/plugins.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# tasks file for adriagalin.neo4j

0 commit comments

Comments
 (0)