ansible-role-elasticsearch/tasks/data.yml

26 lines
890 B
YAML

---
- name: manage users
elasticsearch_user:
name: '{{ item.key }}'
password: '{{ item.value.password }}'
api_user: '{{ elasticsearch_api_user }}'
api_password: '{{ elasticsearch_api_password }}'
loop: '{{ elasticsearch_users|dict2items }}'
when: |
'xpack.security.enabled' in elasticsearch_full_config and
elasticsearch_full_config['xpack.security.enabled'] == True
run_once: true
tags: elasticsearch
- name: copy index templates
elasticsearch_template:
name: '{{ item.key }}'
index_patterns: '{{ item.value.index_patterns }}'
settings: '{{ item.value.settings|default({}) }}'
mappings: '{{ item.value.mappings|default({}) }}'
api_user: '{{ elasticsearch_api_user }}'
api_password: '{{ elasticsearch_api_password }}'
no_log: true
loop: '{{ elasticsearch_index_templates|dict2items }}'
run_once: true
tags: elasticsearch