2015-05-12 14:24:31 +02:00
|
|
|
---
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-11-25 15:28:09 +00:00
|
|
|
- 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}}
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-11-25 15:28:09 +00:00
|
|
|
- debug: msg="Node configuration {{ es_config }} "
|
2015-10-22 19:09:53 +01:00
|
|
|
|
|
|
|
|
# Install OS specific elasticsearch - this can be abbreviated in version 2.0.0
|
|
|
|
|
- name: Include specific Elasticsearch
|
2015-05-13 09:45:55 +02:00
|
|
|
include: elasticsearch-Debian.yml
|
|
|
|
|
when: ansible_os_family == 'Debian'
|
2015-05-12 14:24:31 +02:00
|
|
|
|
2015-10-22 19:09:53 +01:00
|
|
|
- name: Include specific Elasticsearch
|
2015-05-13 09:45:55 +02:00
|
|
|
include: elasticsearch-RedHat.yml
|
|
|
|
|
when: ansible_os_family == 'RedHat'
|
2015-05-12 14:24:31 +02:00
|
|
|
|
2015-10-22 19:09:53 +01:00
|
|
|
#Configuration file for elasticsearch
|
|
|
|
|
- name: Elasticsearch configuration
|
|
|
|
|
include: elasticsearch-config.yml
|
|
|
|
|
|
2015-11-25 15:28:09 +00:00
|
|
|
#We remove the node.name key as it may be set by another node on the same server
|
|
|
|
|
|
|
|
|
|
|
2015-05-13 09:45:55 +02:00
|
|
|
# Make sure the service is started, and restart if necessary
|
|
|
|
|
- name: Start elasticsearch service
|
2015-10-22 19:09:53 +01:00
|
|
|
service: name={{instance_init_script | basename}} state=started
|
2015-05-13 13:33:43 +02:00
|
|
|
when: es_start_service
|
2015-05-13 09:45:55 +02:00
|
|
|
register: elasticsearch_started
|
2015-10-22 19:09:53 +01:00
|
|
|
|
2015-05-13 09:45:55 +02:00
|
|
|
- name: Restart elasticsearch service if new version installed
|
2015-10-22 19:09:53 +01:00
|
|
|
service: name={{instance_init_script | basename}} state=restarted
|
2015-05-22 21:11:33 +02:00
|
|
|
when: es_start_service and
|
|
|
|
|
( elasticsearch_install.changed or elasticsearch_configure.changed )
|
|
|
|
|
and not elasticsearch_started.changed
|