2015-10-22 19:09:53 +01:00
|
|
|
---
|
|
|
|
|
# Configure Elasticsearch Node
|
2015-11-27 19:39:47 +00:00
|
|
|
|
2015-11-27 18:12:59 +00:00
|
|
|
#Create required directories
|
2016-03-18 19:30:11 +00:00
|
|
|
- name: Create Directories
|
|
|
|
|
file: path={{ item }} state=directory owner={{ es_user }} group={{ es_group }}
|
|
|
|
|
with_items:
|
|
|
|
|
- "{{pid_dir}}"
|
|
|
|
|
- "{{log_dir}}"
|
|
|
|
|
- "{{conf_dir}}"
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2016-03-18 19:30:11 +00:00
|
|
|
- name: Create Data Directories
|
|
|
|
|
file: path={{ item }} state=directory owner={{ es_user }} group={{ es_group }}
|
|
|
|
|
with_items:
|
|
|
|
|
- "{{data_dirs}}"
|
2015-12-13 22:46:50 +00:00
|
|
|
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-11-27 18:12:59 +00:00
|
|
|
#Copy the config template
|
|
|
|
|
- name: Copy Configuration File
|
2015-12-13 22:46:50 +00:00
|
|
|
template: src=elasticsearch.yml.j2 dest={{conf_dir}}/elasticsearch.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
2017-08-20 10:30:39 -04:00
|
|
|
register: system_change
|
2015-11-27 18:12:59 +00:00
|
|
|
notify: restart elasticsearch
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-11-27 18:12:59 +00:00
|
|
|
#Copy the instance specific default file
|
|
|
|
|
- name: Copy Default File for Instance
|
|
|
|
|
template: src=elasticsearch.j2 dest={{instance_default_file}} mode=0644 force=yes
|
|
|
|
|
notify: restart elasticsearch
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-11-27 18:12:59 +00:00
|
|
|
#Copy the instance specific init file
|
|
|
|
|
- name: Copy Debian Init File for Instance
|
|
|
|
|
template: src=init/debian/elasticsearch.j2 dest={{instance_init_script}} mode=0755 force=yes
|
2016-03-21 13:21:35 +00:00
|
|
|
when: ansible_os_family == 'Debian' and not use_system_d
|
2015-12-21 13:27:45 +00:00
|
|
|
notify: restart elasticsearch
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-11-27 18:12:59 +00:00
|
|
|
#Copy the instance specific init file
|
|
|
|
|
- name: Copy Redhat Init File for Instance
|
|
|
|
|
template: src=init/redhat/elasticsearch.j2 dest={{instance_init_script}} mode=0755 force=yes
|
2016-03-21 13:21:35 +00:00
|
|
|
when: ansible_os_family == 'RedHat' and not use_system_d
|
2015-12-21 13:27:45 +00:00
|
|
|
notify: restart elasticsearch
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-11-27 18:12:59 +00:00
|
|
|
#Copy the systemd specific file if systemd is installed
|
|
|
|
|
- name: Copy Systemd File for Instance
|
|
|
|
|
template: src=systemd/elasticsearch.j2 dest={{instance_sysd_script}} mode=0644 force=yes
|
2015-11-27 21:43:49 +00:00
|
|
|
when: use_system_d
|
2016-11-03 14:53:45 +01:00
|
|
|
notify:
|
|
|
|
|
- reload systemd configuration
|
|
|
|
|
- restart elasticsearch
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-11-26 14:19:25 +00:00
|
|
|
#Copy the logging.yml
|
2016-11-03 15:24:17 +01:00
|
|
|
- name: Copy log4j2.properties File for Instance
|
2017-08-04 18:22:12 +07:00
|
|
|
template: src={{es_config_log4j2}} dest={{conf_dir}}/log4j2.properties owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
2016-11-03 15:24:17 +01:00
|
|
|
notify: restart elasticsearch
|
|
|
|
|
|
|
|
|
|
- name: Copy jvm.options File for Instance
|
|
|
|
|
template: src=jvm.options.j2 dest={{conf_dir}}/jvm.options owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
|
|
|
|
notify: restart elasticsearch
|
2015-12-14 19:34:09 +00:00
|
|
|
|
|
|
|
|
#Clean up un-wanted package scripts to avoid confusion
|
2016-01-18 14:37:15 +00:00
|
|
|
|
|
|
|
|
- name: Delete Default Init
|
|
|
|
|
file: dest=/etc/init.d/elasticsearch state=absent
|
|
|
|
|
|
|
|
|
|
- name: Delete Default Environment File
|
|
|
|
|
file: dest=/etc/default/elasticsearch state=absent
|
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
|
|
|
|
|
- name: Delete Default Environment File
|
|
|
|
|
file: dest=/etc/sysconfig/elasticsearch state=absent
|
|
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
|
|
- name: Delete Default Sysconfig File
|
2016-11-03 14:53:45 +01:00
|
|
|
file: dest="{{ sysd_script }}" state=absent
|
2016-03-18 19:30:11 +00:00
|
|
|
|
|
|
|
|
- name: Delete Default Configuration File
|
|
|
|
|
file: dest=/etc/elasticsearch/elasticsearch.yml state=absent
|
|
|
|
|
|
|
|
|
|
- name: Delete Default Logging File
|
|
|
|
|
file: dest=/etc/elasticsearch/logging.yml state=absent
|
|
|
|
|
|
2017-01-11 13:02:23 +00:00
|
|
|
- name: Delete Default Logging File
|
2016-11-03 15:24:17 +01:00
|
|
|
file: dest=/etc/elasticsearch/log4j2.properties state=absent
|
|
|
|
|
|
2017-01-11 13:02:23 +00:00
|
|
|
- name: Delete Default JVM Options File
|
2016-11-03 15:24:17 +01:00
|
|
|
file: dest=/etc/elasticsearch/jvm.options state=absent
|