ansible-role-elasticsearch/tasks/elasticsearch-template.yml
Julien Mailleret bc7fc40b34
fix files mode syntax
From Ansible doc (https://docs.ansible.com/ansible/latest/modules/template_module.html#template-module)
For those used to /usr/bin/chmod remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like 0644 or 01777) or quote it (like '644' or '1777') so Ansible receives a string and can do its own conversion from string into number.
Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results.
2019-11-28 07:54:25 +01:00

31 lines
932 B
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: ensure templates dir is created
file:
path: "{{ es_conf_dir }}/templates"
state: directory
owner: root
group: "{{ es_group }}"
mode: "2750"
- name: Copy templates to elasticsearch
copy: src={{ item }} dest={{ es_conf_dir }}/templates owner=root group={{ es_group }} mode=0660
register: load_templates
with_fileglob:
- "{{ es_templates_fileglob | default('') }}"
- name: Install templates
uri:
url: "{{ es_api_uri }}/_template/{{item | filename}}"
method: PUT
status_code: 200
user: "{{es_api_basic_auth_username | default(omit)}}"
password: "{{es_api_basic_auth_password | default(omit)}}"
force_basic_auth: yes
body_format: json
body: "{{ lookup('file', item) }}"
validate_certs: "{{ es_validate_certs }}"
when: load_templates.changed and es_start_service
with_fileglob:
- "{{ es_templates_fileglob | default('') }}"
run_once: True