openstack-ansible-ops/elk_metrics_6x/roles/elastic_retention/tasks/main.yml
Jonathan Rosser c2d3c44fd8 Enforce no_proxy when setting up ELK dashboards and rollups
There is no guarantee that all container IP addressess will be included
in an existing no_proxy environment variable. This will cause failures
when an http proxy is configured, but the proxy does not allow traffic
to 'hairpin' back to internal addresses.

This change forces no_proxy to the specific address of the kibana
and coordinator endpoints when the uri module is used to load dashboards
and configure rollups.

Change-Id: I669334c722cce79459b522e6e2d7e1aaec49ef24
2018-09-10 21:14:11 +00:00

53 lines
1.8 KiB
YAML

---
# Copyright 2018, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Query es storage
uri:
url: "http://{{ coordination_nodes[0] }}/_nodes/{{ (data_nodes | map('extract', hostvars, 'ansible_host') | list) | join(',') }}/stats/fs"
method: GET
register: elk_data
environment:
no_proxy: "{{ coordination_nodes[0].split(':')[0] }}"
until:
- elk_data is success and elk_data['json'] is defined
retries: 5
delay: 10
run_once: true
- name: Set retention keys fact
set_fact:
es_storage_json: "{{ elk_data['json'] }}"
- name: Load retention algo variables
include_vars: "calculate_index_retention_{{ elastic_index_retention_algorithm }}.yml"
tags:
- always
- name: Set retention facts (mb size)
set_fact: "elastic_{{ item.key }}_size={{ item.value }}"
when:
- hostvars[inventory_hostname]["elastic_" ~ item.key ~ "_size"] is undefined
with_dict: "{{ es_storage_per_index }}"
- name: Set retention facts (days)
set_fact: "elastic_{{ item.key }}_retention={{ item.value }}"
when:
- hostvars[inventory_hostname]["elastic_" ~ item.key ~ "_retention"] is undefined
with_dict: "{{ es_days_per_index }}"
- name: Set retention keys fact
set_fact:
elastic_beat_retention_policy_keys: "{{ elastic_beat_retention_policy_hosts.keys() | list }}"