2020-02-09 14:15:24 +00:00
|
|
|
---
|
2023-09-29 13:54:34 +00:00
|
|
|
- name: Init elastic password
|
|
|
|
elasticsearch_init_password:
|
|
|
|
api_user: "{{ elasticsearch_api_user }}"
|
|
|
|
api_password: "{{ elasticsearch_password }}"
|
|
|
|
run_once: true
|
|
|
|
tags: elasticsearch
|
|
|
|
|
|
|
|
- name: Manage users
|
|
|
|
elasticsearch_user:
|
|
|
|
name: "{{ item.key }}"
|
|
|
|
password: "{{ item.value.password }}"
|
|
|
|
roles: "{{ item.value.roles | default(omit) }}"
|
|
|
|
api_user: "{{ elasticsearch_api_user }}"
|
|
|
|
api_password: "{{ elasticsearch_password }}"
|
|
|
|
state: "{{ item.value.state | default('present') }}"
|
|
|
|
loop: "{{ elasticsearch_users | dict2items }}"
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.key }}"
|
|
|
|
run_once: true
|
|
|
|
tags: elasticsearch
|
|
|
|
|
2023-07-05 09:36:13 +00:00
|
|
|
- name: Copy ilm policies
|
2022-02-17 09:52:15 +00:00
|
|
|
elasticsearch_ilm_policy:
|
2023-07-05 09:36:13 +00:00
|
|
|
name: "{{ item.key }}"
|
|
|
|
phases: "{{ item.value | default({}) }}"
|
2023-09-29 13:54:34 +00:00
|
|
|
api_user: "{{ elasticsearch_api_user }}"
|
|
|
|
api_password: "{{ elasticsearch_password }}"
|
2023-07-05 09:36:13 +00:00
|
|
|
loop: "{{ elasticsearch_ilm_policies | dict2items }}"
|
2022-02-17 09:52:15 +00:00
|
|
|
loop_control:
|
2023-07-05 09:36:13 +00:00
|
|
|
label: "{{ item.key }}"
|
2022-02-17 09:52:15 +00:00
|
|
|
run_once: true
|
|
|
|
tags: elasticsearch
|
|
|
|
|
2023-07-05 09:36:13 +00:00
|
|
|
- name: Copy index templates
|
2020-02-09 14:15:24 +00:00
|
|
|
elasticsearch_template:
|
2023-07-05 09:36:13 +00:00
|
|
|
name: "{{ item.key }}"
|
|
|
|
index_patterns: "{{ item.value.index_patterns }}"
|
|
|
|
settings: "{{ item.value.settings | default({}) }}"
|
|
|
|
mappings: "{{ item.value.mappings | default({}) }}"
|
2023-09-29 13:54:34 +00:00
|
|
|
api_user: "{{ elasticsearch_api_user }}"
|
|
|
|
api_password: "{{ elasticsearch_password }}"
|
2023-07-05 09:36:13 +00:00
|
|
|
loop: "{{ elasticsearch_index_templates | dict2items }}"
|
2023-09-29 13:54:34 +00:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item.key }}"
|
2020-02-09 14:15:24 +00:00
|
|
|
run_once: true
|
|
|
|
tags: elasticsearch
|