2015-05-11 16:51:33 +02:00
---
2015-10-22 19:09:53 +01:00
- name : os-specific vars
include_vars : "{{ansible_os_family}}.yml"
2016-04-26 12:11:13 -07:00
tags :
- always
2016-07-22 23:44:27 +01:00
- name : check-set-parameters
include : elasticsearch-parameters.yml
tags :
- always
2015-05-11 16:51:33 +02:00
- include : java.yml
2016-07-20 13:51:14 +01:00
when : es_java_install
2016-04-26 11:45:11 -07:00
tags :
- java
2017-01-11 10:26:57 +00:00
2015-05-12 14:24:31 +02:00
- include : elasticsearch.yml
2016-04-26 11:45:11 -07:00
tags :
- install
2017-01-11 12:17:16 +00:00
2016-01-18 14:37:15 +00:00
- include : elasticsearch-config.yml
2016-04-26 11:45:11 -07:00
tags :
- config
2017-01-11 12:17:16 +00:00
2015-11-25 17:13:45 +00:00
- include : elasticsearch-scripts.yml
when : es_scripts
2016-04-26 11:45:11 -07:00
tags :
- scripts
2017-01-11 12:17:16 +00:00
2016-01-18 14:37:15 +00:00
- include : elasticsearch-plugins.yml
2016-03-18 19:30:11 +00:00
when : es_plugins is defined or es_plugins_reinstall
2016-04-26 11:45:11 -07:00
tags :
- plugins
2017-01-11 12:17:16 +00:00
2016-07-23 21:47:27 +01:00
#We always execute xpack as we may need to remove features
2016-07-22 23:44:27 +01:00
- include : xpack/elasticsearch-xpack.yml
2016-07-08 14:49:21 +01:00
tags :
2016-07-22 23:44:27 +01:00
- xpack
2017-01-11 12:17:16 +00:00
2015-11-25 23:43:01 +00:00
- include : elasticsearch-templates.yml
2015-12-24 13:21:18 +00:00
when : es_templates
2016-04-26 11:45:11 -07:00
tags :
- templates
2017-01-17 14:42:21 +00:00
2017-08-16 11:08:03 +01:00
- name : reload systemd configuration
command : systemctl daemon-reload
# Restart service and ensure it is enabled
- name : restart elasticsearch
service : name={{instance_init_script | basename}} state=restarted enabled=yes
when :
- es_restart_on_change
- es_start_service
- ((plugin_installed is defined and plugin_installed.changed) or (config_updated is defined and config_updated.changed) or (xpack_state.changed) or (debian_elasticsearch_install_from_repo.changed or redhat_elasticsearch_install_from_repo.changed or elasticsearch_install_from_package.changed))
register : es_restarted
2016-07-20 13:51:14 +01:00
- meta : flush_handlers
2017-01-17 14:42:21 +00:00
2017-05-15 15:15:17 +01:00
- name : Make sure elasticsearch is started
service : name={{instance_init_script | basename}} state=started enabled=yes
2017-08-16 11:05:40 +01:00
when : es_start_service
2017-05-15 15:15:17 +01:00
2017-01-17 14:42:21 +00:00
- name : Wait for elasticsearch to startup
2017-03-15 16:12:22 -04:00
wait_for : host={{es_api_host}} port={{es_api_port}} delay=5 connect_timeout=1
2017-08-16 11:05:40 +01:00
when : es_restarted is defined and es_restarted.changed and es_start_service
2017-03-15 16:12:22 -04:00
- name : activate-license
include : ./xpack/security/elasticsearch-xpack-activation.yml
2017-08-16 11:05:40 +01:00
when : es_start_service and es_enable_xpack and es_xpack_license is defined and es_xpack_license != ''
2017-03-15 16:12:22 -04:00
#perform security actions here now elasticsearch is started
- include : ./xpack/security/elasticsearch-security-native.yml
2017-08-16 11:05:40 +01:00
when : es_start_service and (es_enable_xpack and '"security" in es_xpack_features') and ((es_users is defined and es_users.native is defined) or (es_roles is defined and es_roles.native is defined))