Merge pull request #72 from strootman/custom_scripts_templates_57

Custom scripts templates 57
This commit is contained in:
gingerwizard 2016-03-18 15:01:53 +00:00
commit 8859c49268
3 changed files with 9 additions and 3 deletions

View file

@ -188,6 +188,10 @@ controlled by the following parameters:
* ```es_work_dir``` - defaults to "/tmp/elasticsearch". * ```es_work_dir``` - defaults to "/tmp/elasticsearch".
* ```es_plugin_dir``` - defaults to "/usr/share/elasticsearch/plugins". * ```es_plugin_dir``` - defaults to "/usr/share/elasticsearch/plugins".
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.
* ```es_scripts_fileglob``` - defaults to `<role>/files/scripts/`.
* ```es_templates_fileglob``` - defaults to `<role>/files/templates/`.
## Notes ## Notes
* 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. * 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.

View file

@ -10,4 +10,5 @@
when: es_config['path.scripts'] is defined when: es_config['path.scripts'] is defined
- name: Copy scripts to elasticsearch - name: Copy scripts to elasticsearch
copy: src=scripts dest={{ es_script_dir }} owner={{ es_user }} group={{ es_group }} copy: src={{ item }} dest={{ es_script_dir }} owner={{ es_user }} group={{ es_group }}
with_fileglob: es_scripts_fileglob | default("scripts")

View file

@ -1,7 +1,8 @@
--- ---
- name: Copy templates to elasticsearch - name: Copy templates to elasticsearch
copy: src=templates dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }} copy: src={{ item }} dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }}
with_fileglob: es_templates_fileglob | default("templates")
- set_fact: http_port=9200 - set_fact: http_port=9200
@ -17,4 +18,4 @@
- name: Install template(s) - name: Install template(s)
command: "curl -sL -XPUT http://localhost:{{http_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json" command: "curl -sL -XPUT http://localhost:{{http_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json"
with_items: resultstemplate.stdout_lines with_items: resultstemplate.stdout_lines