diff --git a/tasks/elasticsearch-templates.yml b/tasks/elasticsearch-templates.yml new file mode 100644 index 0000000..46ffefc --- /dev/null +++ b/tasks/elasticsearch-templates.yml @@ -0,0 +1,11 @@ +--- +- name: Copy templates to elasticsearch + copy: src=templates dest=/etc/elasticsearch/ + +- 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) + command: 'curl -sL -XPUT http://localhost:9200/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json' + with_items: resultstemplate.stdout_lines