2015-09-14 10:32:20 +02:00
|
|
|
---
|
2015-12-24 13:21:18 +00:00
|
|
|
|
2016-03-21 13:21:35 +00:00
|
|
|
- file: path=/etc/elasticsearch/templates state=directory owner={{ es_user }} group={{ es_group }}
|
|
|
|
|
|
|
|
|
|
- name: Copy default templates to elasticsearch
|
|
|
|
|
copy: src=templates dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }}
|
|
|
|
|
when: es_templates_fileglob is not defined
|
|
|
|
|
|
2015-09-14 10:32:20 +02:00
|
|
|
- name: Copy templates to elasticsearch
|
2016-03-31 10:51:21 +03:00
|
|
|
copy: src={{ item }} dest=/etc/elasticsearch/templates owner={{ es_user }} group={{ es_group }}
|
2016-07-20 12:47:34 +01:00
|
|
|
when: es_templates_fileglob is defined
|
|
|
|
|
with_fileglob:
|
|
|
|
|
- "{{ es_templates_fileglob }}"
|
2015-09-14 10:32:20 +02:00
|
|
|
|
2016-07-23 16:41:37 +01:00
|
|
|
- name: Ensure elasticsearch is started
|
|
|
|
|
service: name={{instance_init_script | basename}} state=started enabled=yes
|
|
|
|
|
|
2015-09-14 12:15:30 +02:00
|
|
|
- name: Wait for elasticsearch to startup
|
2016-07-22 23:44:27 +01:00
|
|
|
wait_for: port={{es_api_port}} delay=10
|
2015-09-14 12:15:30 +02:00
|
|
|
|
2016-07-23 16:41:37 +01:00
|
|
|
- name: Get template files
|
2015-09-14 10:32:20 +02:00
|
|
|
shell: find . -maxdepth 1 -type f | sed "s#\./##" | sed "s/.json//" chdir=/etc/elasticsearch/templates
|
|
|
|
|
register: resultstemplate
|
|
|
|
|
|
|
|
|
|
- name: Install template(s)
|
2016-07-22 23:44:27 +01:00
|
|
|
command: "curl -sL -XPUT http://{{es_api_host}}:{{es_api_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json"
|
2016-07-23 16:41:37 +01:00
|
|
|
with_items: "{{ resultstemplate.stdout_lines }}"
|