ansible-role-elasticsearch/tasks/main.yml

74 lines
2.2 KiB
YAML
Raw Normal View History

2015-05-11 16:51:33 +02:00
---
- name: os-specific vars
include_vars: "{{ansible_os_family}}.yml"
tags:
- always
- 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
- include: elasticsearch.yml
2016-04-26 11:45:11 -07:00
tags:
- install
2017-01-11 12:17:16 +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
- 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
- include: xpack/elasticsearch-xpack.yml
2016-07-08 14:49:21 +01:00
tags:
- xpack
2017-01-11 12:17:16 +00:00
2015-11-25 23:43:01 +00:00
- include: elasticsearch-templates.yml
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
- name: Make sure elasticsearch is started
service: name={{instance_init_script | basename}} 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
- 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
#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))