73 lines
2.2 KiB
YAML
73 lines
2.2 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
|
|
|
|
- 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
|
|
|
|
- meta: flush_handlers
|
|
|
|
- name: Make sure elasticsearch is started
|
|
service: name={{instance_init_script | basename}} state=started enabled=yes
|
|
when: es_start_service
|
|
|
|
- name: Wait for elasticsearch to startup
|
|
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
|
|
|
|
- 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 != ''
|
|
|
|
#perform security actions here now elasticsearch is started
|
|
- include: ./xpack/security/elasticsearch-security-native.yml
|
|
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))
|