Skip to content

Commit 8859c49

Browse files
author
gingerwizard
committed
Merge pull request elastic#72 from strootman/custom_scripts_templates_57
Custom scripts templates 57
2 parents 7a2db5d + cea242f commit 8859c49

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ controlled by the following parameters:
188188
* ```es_work_dir``` - defaults to "/tmp/elasticsearch".
189189
* ```es_plugin_dir``` - defaults to "/usr/share/elasticsearch/plugins".
190190

191+
This role ships with sample scripts and templates located in the [files/scripts/](files/scripts) and [files/templates/](files/templates) directories, respectively. These variables are used with the Ansible [with_fileglob](http://docs.ansible.com/ansible/playbooks_loops.html#id4) loop. When setting the globs, be sure to use an absolute path.
192+
* ```es_scripts_fileglob``` - defaults to `<role>/files/scripts/`.
193+
* ```es_templates_fileglob``` - defaults to `<role>/files/templates/`.
194+
191195
## Notes
192196

193197
* The role assumes the user/group exists on the server. The elasticsearch packages create the default elasticsearch user. If this needs to be changed, ensure the user exists.

tasks/elasticsearch-scripts.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
when: es_config['path.scripts'] is defined
1111

1212
- name: Copy scripts to elasticsearch
13-
copy: src=scripts dest={{ es_script_dir }} owner={{ es_user }} group={{ es_group }}
13+
copy: src={{ item }} dest={{ es_script_dir }} owner={{ es_user }} group={{ es_group }}
14+
with_fileglob: es_scripts_fileglob | default("scripts")

tasks/elasticsearch-templates.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22

33
- name: Copy templates to elasticsearch
4-
copy: src=templates dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }}
4+
copy: src={{ item }} dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }}
5+
with_fileglob: es_templates_fileglob | default("templates")
56

67
- set_fact: http_port=9200
78

@@ -17,4 +18,4 @@
1718

1819
- name: Install template(s)
1920
command: "curl -sL -XPUT http://localhost:{{http_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json"
20-
with_items: resultstemplate.stdout_lines
21+
with_items: resultstemplate.stdout_lines

0 commit comments

Comments
 (0)