Move heartbeat from utility_all to kibana

The heartbeat probe was making an assumption that the deployment will
always be an OSA one by using the group "utility_all" as a deployment
target. This change moves heartbeat to the first kibana three kibana
nodes by default which corrects the previous assumption.

Change-Id: Ic1b90eb94dd20dc2273542333de47bfd690af1dd
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-07-20 11:52:04 -05:00
parent 47aff12e6c
commit 0ab9d82545
4 changed files with 37 additions and 23 deletions

View File

@ -1,6 +1,22 @@
---
- name: Set heartbeat host deployment group
hosts: kibana
gather_facts: false
connection: local
tasks:
- name: Add hosts to dynamic inventory group
group_by:
key: heatbeat_deployment_targets
parents: kibana
when:
- inventory_hostname in groups['kibana'][:3]
tags:
- always
- name: Install Heartbeat
hosts: utility_all
hosts: heatbeat_deployment_targets
become: true
vars:
haproxy_ssl: false

View File

@ -1,7 +1,7 @@
---
- name: Load Heartbeat Dashboards
hosts: utility_all[0]
hosts: kibana[0]
gather_facts: false
vars_files:
- vars/variables.yml

View File

@ -65,16 +65,15 @@ heartbeat.monitors:
#fields_under_root: false
{% for item in heartbeat_services %}
{% if inventory_hostname in groups['utility_all'] | default([]) %}
{% if item.type == 'tcp' %}
{% set hosts = [] %}
{% for port in item.ports | default([]) %}
{% for backend in item.group | default([]) %}
{% set backend_host = hostvars[backend]['ansible_host'] %}
{% set _ = hosts.extend([backend_host + ":" + (port | string)]) %}
{% endfor %}
{% if item.type == 'tcp' %}
{% set hosts = [] %}
{% for port in item.ports | default([]) %}
{% for backend in item.group | default([]) %}
{% set backend_host = hostvars[backend]['ansible_host'] %}
{% set _ = hosts.extend([backend_host + ":" + (port | string)]) %}
{% endfor %}
{% if hosts | length > 0 %}
{% endfor %}
{% if hosts | length > 0 %}
- type: tcp # monitor type `tcp`. Connect via TCP and optionally verify endpoint
# by sending/receiving a custom payload
@ -147,16 +146,16 @@ heartbeat.monitors:
# Required TLS protocols
#supported_protocols: ["TLSv1.0", "TLSv1.1", "TLSv1.2"]
{% endif %}
{% elif item.type == 'http' %}
{% set hosts = [] %}
{% for port in item.ports | default([]) %}
{% for backend in item.group | default([]) %}
{% set backend_host = hostvars[backend]['ansible_host'] %}
{% set _ = hosts.extend(["http://" + backend_host + ":" + (port | string) + item.path]) %}
{% endfor %}
{% endif %}
{% elif item.type == 'http' %}
{% set hosts = [] %}
{% for port in item.ports | default([]) %}
{% for backend in item.group | default([]) %}
{% set backend_host = hostvars[backend]['ansible_host'] %}
{% set _ = hosts.extend(["http://" + backend_host + ":" + (port | string) + item.path]) %}
{% endfor %}
{% if hosts | length > 0 %}
{% endfor %}
{% if hosts | length > 0 %}
- type: http # monitor type `http`. Connect via HTTP an optionally verify response
# Monitor name used for job name and document type
@ -217,7 +216,7 @@ heartbeat.monitors:
#body:
# Expected response settings
{% if item.check_response is defined %}
{% if item.check_response is defined %}
check.response: {{ item.check_response }}
#check.response:
# Expected status code. If not configured or set to 0 any status code not
@ -229,7 +228,6 @@ heartbeat.monitors:
# Required response contents.
#body:
{% endif %}
{% endif %}
{% endif %}
{% endif %}

View File

@ -44,7 +44,7 @@ elastic_beat_retention_policy_hosts:
apm: "{{ groups['apm-server'] | default([null]) | length }}"
auditbeat: "{{ groups['hosts'] | default([null]) | length }}"
filebeat: "{{ groups['hosts'] | default([null]) | length }}"
heartbeat: "{{ groups['utility_all'] | default([null]) | length }}"
heartbeat: "{{ groups['kibana'][:3] | default([null]) | length }}"
journalbeat: "{{ groups['all'] | default([null]) | length }}"
metricbeat: "{{ groups['all'] | default([null]) | length }}"
packetbeat: "{{ groups['hosts'] | default([null]) | length }}"