ansible-role-elasticsearch/tasks/main.yml

100 lines
2.9 KiB
YAML
Raw Normal View History

2015-05-11 16:51:33 +02:00
---
- set_fact: "es_major_version={{ es_version.split('.')[0] }}.x"
when:
- es_major_version is undefined
- name: os-specific vars
include_vars: "{{ansible_os_family}}.yml"
tags:
- always
- name: set compatibility variables
include: compatibility-variables.yml
tags:
- always
- name: check-set-parameters
include: elasticsearch-parameters.yml
tags:
- always
- 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
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
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
#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:
- xpack
2017-01-11 12:17:16 +00: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
- name: Make sure elasticsearch is started
2018-06-26 15:13:19 -04:00
become: yes
service: name=elasticsearch state=started enabled=yes
when: es_start_service
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
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
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-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
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
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
#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
when: es_templates
tags:
2018-02-04 07:09:23 +00:00
- templates