[templates] simplify template install task

This commit is contained in:
Julien Mailleret 2019-05-09 19:39:09 +02:00
parent a1c81884e2
commit a677218fa8
No known key found for this signature in database
GPG key ID: F065093271C8DE71

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