Merge "Break out setup and always tag facts"

This commit is contained in:
Zuul 2018-06-15 23:18:22 +00:00 committed by Gerrit Code Review
commit 2e8a6b0da3
19 changed files with 266 additions and 154 deletions

View File

@ -4,15 +4,21 @@
- name: Node count fact
set_fact:
storage_node_count: "{{ groups['elastic-logstash'] | length }}"
tags:
- always
- name: Master node pre-count fact
set_fact:
_master_node_count: "{{ ((storage_node_count | int) > 1) | ternary((((storage_node_count | int) // 2) | int), 1) }}"
tags:
- always
# if the master node count is even, add one to it otherwise use the provided value
- name: Master node count fact
set_fact:
master_node_count: "{{ ((_master_node_count | int) % 2 != 0) | ternary((_master_node_count | int), ((_master_node_count | int) + 1)) }}"
tags:
- always
- name: Data nodes fact
set_fact:
@ -30,10 +36,14 @@
{% set _ = nodes.insert(loop.index, (hostvars[host]['ansible_host'] | string)) %}
{% endfor %}
{{ nodes }}
tags:
- always
- name: Data node count fact
set_fact:
data_node_count: "{{ data_nodes | length }}"
tags:
- always
# if the master node count is even, add one to it otherwise use the provided value
# set the data nodes to be all master and alternate through the remaining nodes
@ -41,6 +51,8 @@
set_fact:
master_node: "{{ (inventory_hostname in master_nodes) | ternary(true, false) }}"
data_node: "{{ (inventory_hostname in data_nodes) | ternary(true, false) }}"
tags:
- always
# Set a data node facts. The data nodes, in the case of elasticsearch are also
# ingest nodes.
@ -68,3 +80,5 @@
{% set data_hosts = nodes | shuffle(seed=inventory_hostname) %}
{% endif %}
{{ data_hosts }}
tags:
- always

View File

@ -47,25 +47,7 @@
enabled: true
state: restarted
- name: Load apm-server Dashboards
hosts: apm-server[0]
become: true
vars_files:
- vars/variables.yml
tasks:
- name: Load templates
shell: >-
apm-server setup
{{ item }}
-E 'apm-server.host=localhost:8200'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup
- server-install
- import_playbook: setupAPMserver.yml

View File

@ -56,26 +56,7 @@
enabled: "{{ not inventory_hostname in groups['kibana'] | default([]) }}"
state: restarted
- name: Load Auditbeat Dashboards
hosts: hosts[0]
become: true
vars_files:
- vars/variables.yml
tasks:
- name: Load templates
shell: >-
auditbeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup
- beat-install
- import_playbook: setupAuditbeat.yml

View File

@ -119,3 +119,6 @@
name: "curator.timer"
enabled: true
state: restarted
tags:
- beat-install

View File

@ -126,3 +126,6 @@
state: restarted
tags:
- config
tags:
- server-install

View File

@ -152,26 +152,7 @@
enabled: true
state: restarted
- name: Load Filebeat Dashboards
hosts: hosts[0]
become: true
vars_files:
- vars/variables.yml
tasks:
- name: Load templates
shell: >-
filebeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup
- beat-install
- import_playbook: setupFilebeat.yml

View File

@ -45,26 +45,7 @@
enabled: true
state: restarted
- name: Load Heartbeat Dashboards
hosts: utility_all[0]
become: true
vars_files:
- vars/variables.yml
tasks:
- name: Load templates
shell: >-
heartbeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup
- beat-install
- import_playbook: setupHeartbeat.yml

View File

@ -123,26 +123,7 @@
state: restarted
daemon_reload: yes
tags:
- beat-install
## NOTE(cloudnull): This task is broken at this point due to missing
## configuration. Once the following issue
## [ https://github.com/mheese/journalbeat/issues/136 ] is
## resolved this should be uncommented.
# - name: Load Journalbeat Dashboards
# hosts: hosts[0]
# become: true
# vars_files:
# - vars/variables.yml
# tasks:
# - name: Load templates
# shell: >-
# /usr/local/bin/journalbeat -setup
# -E 'output.logstash.enabled=false'
# -E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
# -e -v
# register: templates
# until: templates is success
# retries: 3
# delay: 2
# tags:
# - beat-setup
- import_playbook: setupJournalbeat.yml

View File

@ -68,3 +68,6 @@
name: "kibana"
enabled: true
state: restarted
tags:
- server-install

View File

@ -169,3 +169,6 @@
name: "logstash"
enabled: true
state: restarted
tags:
- server-install

View File

@ -172,27 +172,7 @@
name: "metricbeat"
enabled: true
state: restarted
- name: Load Metricsbeat Dashboards
hosts: all[0]
become: true
vars_files:
- vars/variables.yml
tasks:
- name: Load templates
shell: >-
metricbeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup
- beat-install
- import_playbook: setupMetricbeat.yml

View File

@ -48,26 +48,7 @@
enabled: true
state: restarted
- name: Load Packetbeat Dashboards
hosts: hosts[0]
become: true
vars_files:
- vars/variables.yml
tasks:
- name: Load templates
shell: >-
packetbeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup
- beat-install
- import_playbook: setupPacketbeat.yml

View File

@ -0,0 +1,29 @@
---
- name: Load apm-server Dashboards
hosts: apm-server[0]
gather_facts: false
vars_files:
- vars/variables.yml
pre_tasks:
- include_tasks: common_task_data_node_hosts.yml
tasks:
- name: Load templates
shell: >-
apm-server setup
{{ item }}
-E 'apm-server.host=localhost:8200'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup

View File

@ -0,0 +1,29 @@
---
- name: Load Auditbeat Dashboards
hosts: hosts[0]
gather_facts: false
vars_files:
- vars/variables.yml
pre_tasks:
- include_tasks: common_task_data_node_hosts.yml
tasks:
- name: Load templates
shell: >-
auditbeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup

View File

@ -0,0 +1,29 @@
---
- name: Load Filebeat Dashboards
hosts: hosts[0]
gather_facts: false
vars_files:
- vars/variables.yml
pre_tasks:
- include_tasks: common_task_data_node_hosts.yml
tasks:
- name: Load templates
shell: >-
filebeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup

View File

@ -0,0 +1,29 @@
---
- name: Load Heartbeat Dashboards
hosts: utility_all[0]
gather_facts: false
vars_files:
- vars/variables.yml
pre_tasks:
- include_tasks: common_task_data_node_hosts.yml
tasks:
- name: Load templates
shell: >-
heartbeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup

View File

@ -0,0 +1,45 @@
---
# 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: Load Journalbeat Dashboards
hosts: hosts[0]
gather_facts: false
vars_files:
- vars/variables.yml
pre_tasks:
# NOTE(cloudnull): This task is broken at this point due to missing
# configuration. Once the following issue
# [ https://github.com/mheese/journalbeat/issues/136 ] is
# resolved, this should be removed.
- name: exit playbook
meta: end_play
- include_tasks: common_task_data_node_hosts.yml
tasks:
- name: Load templates
shell: >-
/usr/local/bin/journalbeat -setup
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup

View File

@ -0,0 +1,29 @@
---
- name: Load Metricsbeat Dashboards
hosts: all[0]
gather_facts: false
vars_files:
- vars/variables.yml
pre_tasks:
- include_tasks: common_task_data_node_hosts.yml
tasks:
- name: Load templates
shell: >-
metricbeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup

View File

@ -0,0 +1,29 @@
---
- name: Load Packetbeat Dashboards
hosts: hosts[0]
gather_facts: false
vars_files:
- vars/variables.yml
pre_tasks:
- include_tasks: common_task_data_node_hosts.yml
tasks:
- name: Load templates
shell: >-
packetbeat setup
{{ item }}
-E 'output.logstash.enabled=false'
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
-e -v
with_items:
- "--template"
- "--dashboards"
register: templates
until: templates is success
retries: 3
delay: 2
tags:
- beat-setup