Merge pull request #559 from elastic/template-install

[templates] simplify template install task
This commit is contained in:
Julien Mailleret 2019-05-10 11:00:53 +02:00 committed by GitHub
commit a016ff6e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,29 +13,16 @@
with_fileglob:
- "{{ es_templates_fileglob | default('') }}"
- name: Install templates without auth
- name: Install templates
uri:
url: "http://{{es_api_host}}:{{es_api_port}}/_template/{{item | filename}}"
method: PUT
status_code: 200
user: "{{es_api_basic_auth_username | default(omit)}}"
password: "{{es_api_basic_auth_password | default(omit)}}"
body_format: json
body: "{{ lookup('file', item) }}"
when: load_templates.changed and es_start_service and (not es_enable_xpack or not es_xpack_features is defined or "security" not in es_xpack_features)
with_fileglob:
- "{{ es_templates_fileglob | default('') }}"
run_once: True
- name: Install templates with auth
uri:
url: "http://{{es_api_host}}:{{es_api_port}}/_template/{{item | filename}}"
method: PUT
status_code: 200
user: "{{es_api_basic_auth_username}}"
password: "{{es_api_basic_auth_password}}"
force_basic_auth: yes
body_format: json
body: "{{ lookup('file', item) }}"
when: load_templates.changed and es_start_service and es_enable_xpack and es_xpack_features is defined and "security" in es_xpack_features
when: load_templates.changed and es_start_service
with_fileglob:
- "{{ es_templates_fileglob | default('') }}"
run_once: True