ansible-role-elasticsearch/tasks/elasticsearch.yml

33 lines
1.3 KiB
YAML
Raw Normal View History

---
2015-11-24 17:32:36 +00:00
- debug: msg="Node configuration {{ es_config }} "
- set_fact: instance_default_file={{default_file | dirname}}/{{es_config["node_name_prefix"]}}{{default_file | basename}}
- set_fact: instance_init_script={{init_script | dirname }}/{{es_config['node_name_prefix']}}{{init_script | basename}}
- set_fact: instance_config_directory={{ es_conf_dir }}/{{es_config['node_name_prefix']}}elasticsearch
# 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-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