ansible-role-elasticsearch/tasks/elasticsearch.yml

36 lines
1.3 KiB
YAML
Raw Normal View History

---
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-11-25 15:28:09 +00:00
- debug: msg="Node configuration {{ es_config }} "
# 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'
- name: Include specific Elasticsearch
2015-05-13 09:45:55 +02:00
include: elasticsearch-RedHat.yml
when: ansible_os_family == 'RedHat'
#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
service: name={{instance_init_script | basename}} state=started
when: es_start_service
2015-05-13 09:45:55 +02:00
register: elasticsearch_started
2015-05-13 09:45:55 +02:00
- name: Restart elasticsearch service if new version installed
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