Extend auto change detection

This change makes it possible for a deployer to modify the set of
indexes and weights assosiated with them. If modified, the local
facts will be automatically updated.

Change-Id: Iaea1f22d8aad2abdd02801dd9acad5f969b78d0e
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-12-19 10:32:28 -06:00
parent f7552334ba
commit ad91d5773e
2 changed files with 7 additions and 5 deletions

View File

@ -16,7 +16,8 @@
become: true become: true
vars: vars:
elastic_refresh_interval: "{{ (elasticsearch_number_of_replicas | int) * 5 }}" _elastic_refresh_interval: "{{ (elasticsearch_number_of_replicas | int) * 5 }}"
elastic_refresh_interval: "{{ (_elastic_refresh_interval > 0) | ternary(30, _elastic_refresh_interval) }}"
vars_files: vars_files:
- vars/variables.yml - vars/variables.yml
@ -47,7 +48,7 @@
mapping: mapping:
total_fields: total_fields:
limit: "10000" limit: "10000"
refresh_interval: "5s" refresh_interval: "{{ elastic_refresh_interval }}"
- name: "_all/_settings?preserve_existing=true" - name: "_all/_settings?preserve_existing=true"
index_options: index_options:
index.queries.cache.enabled: "true" index.queries.cache.enabled: "true"
@ -64,7 +65,6 @@
method: HEAD method: HEAD
failed_when: false failed_when: false
register: check_basicIndexTemplate register: check_basicIndexTemplate
register: check_basicIndexTemplate
until: check_basicIndexTemplate is success until: check_basicIndexTemplate is success
retries: 3 retries: 3
delay: 30 delay: 30

View File

@ -67,12 +67,12 @@
option: "cluster_nodes" option: "cluster_nodes"
value: "{{ groups['elastic-logstash'] | length }}" value: "{{ groups['elastic-logstash'] | length }}"
- name: Set retention policy fact - name: Set retention policy keys fact
ini_file: ini_file:
dest: "/etc/ansible/facts.d/elastic.fact" dest: "/etc/ansible/facts.d/elastic.fact"
section: "retention" section: "retention"
option: "elastic_beat_retention_policy_keys" option: "elastic_beat_retention_policy_keys"
value: "{{ elastic_beat_retention_policy_hosts.keys() | list }}" value: "{{ elastic_beat_retention_policy_hosts.keys() | list | sort }}"
- name: Set size fact - name: Set size fact
ini_file: ini_file:
@ -99,4 +99,6 @@
when: when:
- (ansible_local['elastic']['retention']['cluster_nodes'] is undefined) or - (ansible_local['elastic']['retention']['cluster_nodes'] is undefined) or
((groups['elastic-logstash'] | length) != (ansible_local['elastic']['retention']['cluster_nodes'] | int)) or ((groups['elastic-logstash'] | length) != (ansible_local['elastic']['retention']['cluster_nodes'] | int)) or
((ansible_local['elastic']['retention']['elastic_beat_retention_policy_keys'] is defined) and
((ansible_local['elastic']['retention']['elastic_beat_retention_policy_keys'] | from_yaml) != (elastic_beat_retention_policy_hosts.keys() | list | sort))) or
(elastic_retention_refresh | bool) (elastic_retention_refresh | bool)