Templates now invoked as handler to cover edge cases
This commit is contained in:
parent
048fd63602
commit
31cc54ddbc
3 changed files with 29 additions and 20 deletions
16
handlers/elasticsearch-templates.yml
Normal file
16
handlers/elasticsearch-templates.yml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
|
||||
- name: Ensure elasticsearch is started
|
||||
service: name={{instance_init_script | basename}} state=started enabled=yes
|
||||
|
||||
- name: Wait for elasticsearch to startup
|
||||
wait_for: port={{es_api_port}} delay=10
|
||||
|
||||
- name: Get template files
|
||||
shell: find . -maxdepth 1 -type f | sed "s#\./##" | sed "s/.json//" chdir=/etc/elasticsearch/templates
|
||||
register: resultstemplate
|
||||
|
||||
#The basic auth details here may not be required - send always if they are defined. If not needed they will be ignored.
|
||||
- name: Install template(s) with auth
|
||||
command: "curl -sL -XPUT http://{{es_api_host}}:{{es_api_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json {% if es_api_basic_auth_username is defined and es_api_basic_auth_password is defined%}-u {{es_api_basic_auth_username}}:{{es_api_basic_auth_password}}{% endif %}"
|
||||
with_items: "{{ resultstemplate.stdout_lines }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue