Skip to content

Commit

Permalink
Use JNA temp folder on /var/lib
Browse files Browse the repository at this point in the history
  • Loading branch information
bcdonadio committed Jun 13, 2017
1 parent 3621561 commit 82b9948
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 22 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ es_group: elasticsearch
es_config: {}
#Need to provide default directories
es_pid_dir: "/var/run/elasticsearch"
es_tmp_dir: "/var/lib/elasticsearch/tmp"
es_data_dirs: "/var/lib/elasticsearch"
es_log_dir: "/var/log/elasticsearch"
es_max_open_files: 65536
Expand Down
3 changes: 2 additions & 1 deletion tasks/elasticsearch-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
- "{{pid_dir}}"
- "{{log_dir}}"
- "{{conf_dir}}"
- "{{tmp_dir}}"

- name: Create Data Directories
file: path={{ item }} state=directory owner={{ es_user }} group={{ es_group }}
with_items:
- "{{es_data_dirs}}"
- "{{data_dirs}}"


#Copy the config template
- name: Copy Configuration File
template: src=elasticsearch.yml.j2 dest={{conf_dir}}/elasticsearch.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
Expand Down
18 changes: 0 additions & 18 deletions tasks/elasticsearch-optional-user.yml

This file was deleted.

1 change: 1 addition & 0 deletions tasks/elasticsearch-parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@
- set_fact: instance_suffix={{inventory_hostname}}-{{ es_instance_name }}
- set_fact: pid_dir={{ es_pid_dir }}/{{instance_suffix}}
- set_fact: log_dir={{ es_log_dir }}/{{instance_suffix}}
- set_fact: tmp_dir={{ es_tmp_dir }}/{{instance_suffix}}
- set_fact: data_dirs={{ es_data_dirs | append_to_list('/'+instance_suffix) }}
39 changes: 39 additions & 0 deletions tasks/elasticsearch-user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
#Add the elasticsearch user before installing from packages.
- name: Ensure elasticsearch group is created
group:
state: present
name: "{{ es_group }}"
system: yes
when: es_group_id is not defined

- name: Ensure elasticsearch group is created with the correct id.
group:
state: present
name: "{{ es_group }}"
system: yes
gid: "{{ es_group_id }}"
when: es_group_id is defined

- name: Ensure elasticsearch user is created
user:
state: present
name: "{{ es_user }}"
comment: elasticsearch system user
system: yes
createhome: no
home: "{{ es_data_dirs }}" #WORKAROUND: https://github.com/elastic/elasticsearch/issues/18272
group: "{{ es_group }}"
when: es_user_id is not defined

- name: Ensure elasticsearch user is created with the correct id.
user:
state: present
name: "{{ es_user }}"
comment: elasticsearch system user
system: yes
createhome: no
home: "{{ es_data_dirs }}" #WORKAROUND: https://github.com/elastic/elasticsearch/issues/18272
uid: "{{ es_user_id }}"
group: "{{ es_group }}"
when: es_user_id is defined
5 changes: 2 additions & 3 deletions tasks/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---

- name: Include optional user and group creation.
when: (es_user_id is defined) and (es_group_id is defined)
include: elasticsearch-optional-user.yml
- name: Include user and group creation.
include: elasticsearch-user.yml

- name: Include specific Elasticsearch
include: elasticsearch-Debian.yml
Expand Down
3 changes: 3 additions & 0 deletions templates/jvm.options.j2
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
# use our provided JNA always versus the system one
-Djna.nosys=true

# use a custom tmp folder for JNA as some systems don't allow exec on tmp
-Djna.tmpdir={{tmp_dir}}

# flags to keep Netty from being unsafe
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
Expand Down

0 comments on commit 82b9948

Please sign in to comment.