Break out setup and always tag facts
This change breaks out the basic install and setup playbooks into different playbooks. This is done to ensure an operator can easily rerun any part of the playbook as they upgrade, change, or modify a setup over the lifetime of the deployment. Change-Id: I66c53fcb21880c950ea3fee202e7d2224dfdff3a Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
977c2b9c58
commit
fb7aed401b
@ -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
|
||||
|
@ -43,25 +43,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
|
||||
|
@ -52,26 +52,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
|
||||
|
@ -113,3 +113,6 @@
|
||||
name: "curator.timer"
|
||||
enabled: true
|
||||
state: restarted
|
||||
|
||||
tags:
|
||||
- beat-install
|
||||
|
@ -114,3 +114,6 @@
|
||||
state: restarted
|
||||
tags:
|
||||
- config
|
||||
|
||||
tags:
|
||||
- server-install
|
||||
|
@ -148,26 +148,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
|
||||
|
@ -41,26 +41,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
|
||||
|
@ -119,26 +119,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
|
||||
|
@ -56,3 +56,6 @@
|
||||
name: "kibana"
|
||||
enabled: true
|
||||
state: restarted
|
||||
|
||||
tags:
|
||||
- server-install
|
||||
|
@ -157,3 +157,6 @@
|
||||
name: "logstash"
|
||||
enabled: true
|
||||
state: restarted
|
||||
|
||||
tags:
|
||||
- server-install
|
||||
|
@ -156,27 +156,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
|
||||
|
@ -44,26 +44,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
|
||||
|
29
elk_metrics_6x/setupAPMserver.yml
Normal file
29
elk_metrics_6x/setupAPMserver.yml
Normal 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
|
29
elk_metrics_6x/setupAuditbeat.yml
Normal file
29
elk_metrics_6x/setupAuditbeat.yml
Normal 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
|
29
elk_metrics_6x/setupFilebeat.yml
Normal file
29
elk_metrics_6x/setupFilebeat.yml
Normal 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
|
29
elk_metrics_6x/setupHeartbeat.yml
Normal file
29
elk_metrics_6x/setupHeartbeat.yml
Normal 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
|
45
elk_metrics_6x/setupJournalbeat.yml
Normal file
45
elk_metrics_6x/setupJournalbeat.yml
Normal 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
|
29
elk_metrics_6x/setupMetricbeat.yml
Normal file
29
elk_metrics_6x/setupMetricbeat.yml
Normal 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
|
29
elk_metrics_6x/setupPacketbeat.yml
Normal file
29
elk_metrics_6x/setupPacketbeat.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user