2015-09-14 10:32:20 +02:00
|
|
|
---
|
2015-11-25 15:28:09 +00:00
|
|
|
#TODO: How to handle in multi node
|
2015-11-25 23:43:01 +00:00
|
|
|
# 1. Template directory needs to be specifiable
|
2015-09-14 10:32:20 +02:00
|
|
|
- name: Copy templates to elasticsearch
|
2015-11-26 10:20:58 +00:00
|
|
|
copy: src=templates dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }}
|
2015-09-14 10:32:20 +02:00
|
|
|
|
2015-11-25 23:43:01 +00:00
|
|
|
- set_fact: http_port=9200
|
|
|
|
|
|
|
|
|
|
- set_fact: http_port={{es_config['http.port']}}
|
|
|
|
|
when: es_config['http.port'] is defined
|
|
|
|
|
|
2015-09-14 12:15:30 +02:00
|
|
|
- name: Wait for elasticsearch to startup
|
2015-11-25 23:43:01 +00:00
|
|
|
wait_for: port={{http_port}} delay=10
|
2015-09-14 12:15:30 +02:00
|
|
|
|
2015-09-14 10:32:20 +02:00
|
|
|
- name: Get template files
|
|
|
|
|
shell: find . -maxdepth 1 -type f | sed "s#\./##" | sed "s/.json//" chdir=/etc/elasticsearch/templates
|
|
|
|
|
register: resultstemplate
|
|
|
|
|
|
|
|
|
|
- name: Install template(s)
|
2015-11-25 23:43:01 +00:00
|
|
|
command: "curl -sL -XPUT http://localhost:{{http_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json"
|
2015-11-26 10:20:58 +00:00
|
|
|
with_items: resultstemplate.stdout_lines
|