2015-05-11 16:51:33 +02:00
---
2019-05-09 09:06:02 +02:00
- set_fact : "es_major_version={{ es_version.split('.')[0] }}.x"
when :
- es_major_version is undefined
2019-08-06 16:00:14 +02:00
tags :
- always
2019-05-09 09:06:02 +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
2018-06-14 14:44:31 +02:00
- name : set compatibility variables
include : compatibility-variables.yml
tags :
- always
2016-07-22 23:44:27 +01:00
- name : check-set-parameters
include : elasticsearch-parameters.yml
tags :
- always
2018-06-13 08:24:42 +02:00
- name : use snapshot release
include : snapshot-release.yml
when : es_use_snapshot_release
2018-02-04 07:09:23 +00:00
- name : include java.yml
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
2018-02-04 07:09:23 +00:00
- name : include elasticsearch.yml
include : elasticsearch.yml
2016-04-26 11:45:11 -07:00
tags :
- install
2017-01-11 12:17:16 +00:00
2018-02-04 07:09:23 +00:00
- name : include elasticsearch-config.yml
include : elasticsearch-config.yml
2016-04-26 11:45:11 -07:00
tags :
- config
2017-01-11 12:17:16 +00:00
2018-02-04 07:09:23 +00:00
- name : include elasticsearch-plugins.yml
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
2018-02-04 07:09:23 +00:00
- name : include xpack/elasticsearch-xpack.yml
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
2019-06-27 13:53:23 -07:00
- name : include ssl.yml
include : elasticsearch-ssl.yml
2018-02-04 07:09:23 +00:00
- name : flush handlers
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
2018-06-26 15:13:19 -04:00
become : yes
2019-06-03 14:18:09 +02:00
service : name=elasticsearch 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
2018-02-04 07:09:23 +00:00
- name : set fact manage_native_realm to false
set_fact : manage_native_realm=false
2017-09-21 00:20:54 +01:00
2018-02-04 07:09:23 +00:00
- name : set fact manage_native_realm to true
set_fact : manage_native_realm=true
2019-05-29 12:10:11 +02:00
when :
- es_start_service
- es_enable_xpack
- (es_users is defined and es_users.native is defined) or (es_roles is defined and es_roles.native is defined)
2017-09-20 22:58:17 +01:00
2017-09-21 00:20:54 +01:00
# If playbook runs too fast, Native commands could fail as the Native Realm is not yet up
- name : Wait 15 seconds for the Native Relm to come up
2019-02-07 12:24:16 +01:00
command : sleep 15
2017-09-21 00:20:54 +01:00
when : manage_native_realm
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
2017-09-21 00:20:54 +01:00
#perform security actions here now elasticsearch is started
2018-02-04 07:09:23 +00:00
- name : include xpack/security/elasticsearch-security-native.yml
include : ./xpack/security/elasticsearch-security-native.yml
2017-09-21 00:20:54 +01:00
when : manage_native_realm
2017-09-20 22:58:17 +01:00
#Templates done after restart - handled by flushing the handlers. e.g. suppose user removes security on a running node and doesn't specify es_api_basic_auth_username and es_api_basic_auth_password. The templates will subsequently not be removed if we don't wait for the node to restart.
#We also do after the native realm to ensure any changes are applied here first and its denf up.
2018-02-04 07:09:23 +00:00
- name : include elasticsearch-template.yml
include : elasticsearch-template.yml
2017-09-20 22:58:17 +01:00
when : es_templates
tags :
2018-02-04 07:09:23 +00:00
- templates