Update index retention policy to ensure its an int
The current variable, when there's only one host will result in 'false' instead of 0, which is a jinja-ism however due to java-ism's "false" is evaluated to 5 and that makes the index retention policy very wrong. Change-Id: I2668e17c1cf15fe47842ff349ffa4f71c70257e5 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
1700a81291
commit
ca23f9a987
@ -112,7 +112,7 @@
|
||||
# ingest nodes.
|
||||
- name: Set data nodes
|
||||
set_fact:
|
||||
elasticsearch_number_of_replicas: "{{ ((data_nodes | length) > 1) | ternary(((data_nodes | length) > 2 | ternary(2, 1)), 0) }}"
|
||||
elasticsearch_number_of_replicas: "{{ ((data_nodes | length) > 2) | ternary('2', ((data_nodes | length) > 1) | ternary('1', '0')) }}"
|
||||
elasticsearch_data_hosts: |-
|
||||
{% set nodes = elasticsearch_data_node_details %}
|
||||
{% if inventory_hostname in data_nodes %}
|
||||
|
@ -44,4 +44,4 @@
|
||||
indices.queries.cache.size: "5%"
|
||||
- name: "_all/_settings"
|
||||
index_options:
|
||||
index.number_of_replicas: "{{ elasticsearch_number_of_replicas }}"
|
||||
index.number_of_replicas: "{{ elasticsearch_number_of_replicas | int }}"
|
||||
|
@ -3,7 +3,7 @@
|
||||
# These settings can be adjusted to load your own template or overwrite existing ones.
|
||||
|
||||
# Set to false to disable template loading.
|
||||
setup.template.enabled: false
|
||||
setup.template.enabled: {{ inventory_hostname == data_nodes[0] }}
|
||||
|
||||
# Template name. By default the template name is "{{ beat_name }}-%{[beat.version]}"
|
||||
# The template name and pattern has to be set in case the elasticsearch index pattern is modified.
|
||||
@ -18,7 +18,7 @@ setup.template.pattern: "{{ beat_name }}-%{[beat.version]}-*"
|
||||
setup.template.fields: "${path.config}/fields.yml"
|
||||
|
||||
# Overwrite existing template
|
||||
setup.template.overwrite: false
|
||||
setup.template.overwrite: {{ inventory_hostname == data_nodes[0] }}
|
||||
|
||||
{% set shards = ((data_nodes | length) * 3) | int %}
|
||||
|
||||
@ -35,7 +35,7 @@ setup.template.settings:
|
||||
number_of_routing_shards: {{ (shards | int) * 2 }}
|
||||
# The default number of replicas will be based on the number of data nodes
|
||||
# within the environment with a limit of 2 replicas.
|
||||
number_of_replicas: {{ elasticsearch_number_of_replicas }}
|
||||
number_of_replicas: {{ elasticsearch_number_of_replicas | int }}
|
||||
|
||||
# A dictionary of settings for the _source field. For more details, please check
|
||||
# https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html
|
||||
|
@ -68,7 +68,7 @@
|
||||
"exclude_nodes": (groups['kibana'] | map('extract', hostvars, 'ansible_host') | list)
|
||||
},
|
||||
"number_of_shards": 1,
|
||||
"number_of_replicas": elasticsearch_number_of_replicas,
|
||||
"number_of_replicas": (elasticsearch_number_of_replicas | int),
|
||||
"shrink_suffix": '-shrink',
|
||||
"copy_aliases": true,
|
||||
"delete_after": true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user