2.0 Support + Plugin Directory Support + Supporting Tests + Defaults Change

This commit is contained in:
Dale McDiarmid 2015-12-13 22:46:50 +00:00
parent 1034995899
commit 86f2bd9a2d
40 changed files with 297 additions and 113 deletions

View file

@ -3,15 +3,15 @@
- fail: msg="es_instance_name must be specified"
when: es_instance_name is not defined
- set_fact: multi_cast={{ (es_version | version_compare('2.0', '<') and es_config['discovery.zen.ping.multicast.enabled'] is not defined) or es_config['discovery.zen.ping.multicast.enabled']}}
- set_fact: multi_cast={{ (es_version | version_compare('2.0', '<') and es_config['discovery.zen.ping.multicast.enabled'] is not defined) or (es_config['discovery.zen.ping.multicast.enabled'] is defined and es_config['discovery.zen.ping.multicast.enabled'])}}
- fail: msg="Parameter 'http.port' must be defined when multicast is disabled"
- debug: msg="WARNING - It is recommended you specify the parameter 'http.port' when multicast is disabled"
when: not multi_cast and es_config['http.port'] is not defined
- fail: msg="Parameter 'transport.tcp.port' must be defined when multicast is disabled"
- debug: msg="WARNING - It is recommended you specify the parameter 'transport.tcp.port' when multicast is disabled"
when: not multi_cast and es_config['transport.tcp.port'] is not defined
- fail: msg="Parameter 'discovery.zen.ping.unicast.hosts' must be defined when multicast is disabled"
- debug: msg="WARNING - It is recommended you specify the parameter 'discovery.zen.ping.unicast.hosts' when multicast is disabled"
when: not multi_cast and es_config['discovery.zen.ping.unicast.hosts'] is not defined
#If the user attempts to lock memory they must specify a heap size

View file

@ -12,7 +12,7 @@
#For directories we also use the {{inventory_hostname}}-{{ es_instance_name }} - this helps if we have a shared SAN.
- set_fact: pid_dir={{es_pid_dir}}/{{inventory_hostname}}-{{ es_instance_name }}
- set_fact: pid_dir={{ es_pid_dir }}/{{inventory_hostname}}-{{ es_instance_name }}
- set_fact: data_dir={{ es_data_dir }}/{{inventory_hostname}}-{{ es_instance_name }}
@ -34,11 +34,14 @@
file: state=directory path={{ log_dir }} owner={{ es_user }} group={{ es_group }}
- name: Create Config Directory
file: path={{ instance_config_directory }} state=directory owner={{ es_user }} group={{ es_group }}
file: path={{ conf_dir }} state=directory owner={{ es_user }} group={{ es_group }}
- name: Create Plugin Directory
file: state=directory path={{ plugin_dir }} owner={{ es_user }} group={{ es_group }}
#Copy the config template
- name: Copy Configuration File
template: src=elasticsearch.yml.j2 dest={{instance_config_directory}}/elasticsearch.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
template: src=elasticsearch.yml.j2 dest={{conf_dir}}/elasticsearch.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
notify: restart elasticsearch
#Copy the instance specific default file
@ -64,5 +67,5 @@
#Copy the logging.yml
- name: Copy Logging.yml File for Instance
template: src=logging.yml.j2 dest={{instance_config_directory}}/logging.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
template: src=logging.yml.j2 dest={{conf_dir}}/logging.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
notify: restart elasticsearch

View file

@ -1,15 +1,26 @@
---
- name: Remove elasticsearch plugins
command: /usr/share/elasticsearch/bin/plugin --remove {{ item.plugin }} --silent
command: "{{es_home}}/bin/plugin remove {{ item.plugin }} --silent"
ignore_errors: yes
with_items: es_plugins
when: ( ansible_os_family == 'RedHat' or ansible_os_family == 'Debian' ) and es_plugins_reinstall
notify: restart elasticsearch
environment:
CONF_DIR: "{{ conf_dir }}"
- name: Install elasticsearch plugins
#debug: var=item
command: /usr/share/elasticsearch/bin/plugin --install {{ item.plugin }}/{{ item.version }} --silent
register: command_result
failed_when: "'Failed to install' in command_result.stderr"
changed_when: command_result.rc == 0
command: "{{es_home}}/bin/plugin install {{ item.plugin }}{% if item.version is defined and item.version != '' %}/{{ item.version }}{% endif %} --silent"
register: plugin_installed
failed_when: "'Failed to install' in plugin_installed.stderr"
changed_when: plugin_installed.rc == 0
with_items: es_plugins
when: ( ansible_os_family == 'RedHat' or ansible_os_family == 'Debian' )
when: ansible_os_family == 'RedHat' or ansible_os_family == 'Debian'
notify: restart elasticsearch
environment:
CONF_DIR: "{{ conf_dir }}"
#Set permissions on plugins directory
- name: Set Plugin Directory Permissions
file: state=directory path={{ plugin_dir }} owner={{ es_user }} group={{ es_group }} recurse=yes

View file

@ -2,7 +2,8 @@
- set_fact: instance_default_file={{default_file | dirname}}/{{es_instance_name}}_{{default_file | basename}}
- set_fact: instance_init_script={{init_script | dirname }}/{{es_instance_name}}_{{init_script | basename}}
- set_fact: instance_config_directory={{ es_conf_dir }}/{{es_instance_name}}
- set_fact: conf_dir={{ es_conf_dir }}/{{es_instance_name}}
- set_fact: plugin_dir={{ es_plugin_dir }}/{{es_instance_name}}
- set_fact: m_lock_enabled={{ es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True }}
- debug: msg="Node configuration {{ es_config }} "
@ -20,7 +21,6 @@
- name: Elasticsearch configuration
include: elasticsearch-config.yml
# Make sure the service is started, and restart if necessary
- name: Start elasticsearch service
service: name={{instance_init_script | basename}} state=started enabled=yes