ansible-role-elasticsearch/tasks/main.yml
janderson2 9197f2fbcd Ensure elasticsearch is always started
Ensure that elasticsearch is started/running even if non of the handlers
are called.  Previously, if the host was provisioned correctly, but
elasticsearch was not running the role would not attempt to start it.
This can happen if elasticsearch was killed, or if the previous ansible
run failed prior to running the handlers.
2017-05-15 15:15:17 +01:00

59 lines
1.5 KiB
YAML

---
- name: os-specific vars
include_vars: "{{ansible_os_family}}.yml"
tags:
- always
- name: check-set-parameters
include: elasticsearch-parameters.yml
tags:
- always
- include: java.yml
when: es_java_install
tags:
- java
- include: elasticsearch.yml
tags:
- install
- include: elasticsearch-config.yml
tags:
- config
- include: elasticsearch-scripts.yml
when: es_scripts
tags:
- scripts
- include: elasticsearch-plugins.yml
when: es_plugins is defined or es_plugins_reinstall
tags:
- plugins
#We always execute xpack as we may need to remove features
- include: xpack/elasticsearch-xpack.yml
tags:
- xpack
- include: elasticsearch-templates.yml
when: es_templates
tags:
- templates
- meta: flush_handlers
- name: Make sure elasticsearch is started
service: name={{instance_init_script | basename}} state=started enabled=yes
- name: Wait for elasticsearch to startup
wait_for: host={{es_api_host}} port={{es_api_port}} delay=5 connect_timeout=1
- name: activate-license
include: ./xpack/security/elasticsearch-xpack-activation.yml
when: es_enable_xpack and es_xpack_license is defined and es_xpack_license != ''
#perform security actions here now elasticsearch is started
- include: ./xpack/security/elasticsearch-security-native.yml
when: (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))