Convert template setup to a role
This change reduces code throughout the playbooks thereby speeding up the task execution. * A new role named `elastic_beat_setup` was created to facilitate template setup as needed. * Beats retention policies are now defined on the elastic-logstash nodes instead of on all target hosts. This method will speed-up deployments on massive installations while streamlining all deployments. * Kibana variable assumptions have been fixed. This will allow for deployments without Kibana to be accomplished. Change-Id: I36343264042e81dfcb68bad0f6c3a503e525eceb Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
9a896aa81a
commit
5586d8a80f
@ -29,3 +29,21 @@
|
|||||||
|
|
||||||
tags:
|
tags:
|
||||||
- apm-server
|
- apm-server
|
||||||
|
|
||||||
|
- name: Setup apm-server rollup
|
||||||
|
hosts: elastic-logstash[0]
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
haproxy_ssl: false
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/variables.yml
|
||||||
|
|
||||||
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: elastic_rollup
|
||||||
|
index_name: apm
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- apm-server
|
||||||
|
@ -24,8 +24,28 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: elastic_auditbeat
|
- role: elastic_auditbeat
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- beat-install
|
||||||
|
|
||||||
|
- name: Setup auditbeat rollup
|
||||||
|
hosts: elastic-logstash[0]
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
haproxy_ssl: false
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/variables.yml
|
||||||
|
|
||||||
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
- role: elastic_rollup
|
- role: elastic_rollup
|
||||||
index_name: auditbeat
|
index_name: auditbeat
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- beat-install
|
- auditbeat
|
||||||
|
|
||||||
|
- import_playbook: fieldRefresh.yml
|
||||||
|
vars:
|
||||||
|
index_pattern: auditbeat-*
|
||||||
|
@ -24,8 +24,28 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: elastic_filebeat
|
- role: elastic_filebeat
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- beat-install
|
||||||
|
|
||||||
|
- name: Setup filebeat rollup
|
||||||
|
hosts: elastic-logstash[0]
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
haproxy_ssl: false
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/variables.yml
|
||||||
|
|
||||||
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
- role: elastic_rollup
|
- role: elastic_rollup
|
||||||
index_name: filebeat
|
index_name: filebeat
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- beat-install
|
- filebeat
|
||||||
|
|
||||||
|
- import_playbook: fieldRefresh.yml
|
||||||
|
vars:
|
||||||
|
index_pattern: filebeat-*
|
||||||
|
@ -38,8 +38,28 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: elastic_heartbeat
|
- role: elastic_heartbeat
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- beat-install
|
||||||
|
|
||||||
|
- name: Setup heartbeat rollup
|
||||||
|
hosts: elastic-logstash[0]
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
haproxy_ssl: false
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/variables.yml
|
||||||
|
|
||||||
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
- role: elastic_rollup
|
- role: elastic_rollup
|
||||||
index_name: heartbeat
|
index_name: heartbeat
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- beat-install
|
- heartbeat
|
||||||
|
|
||||||
|
- import_playbook: fieldRefresh.yml
|
||||||
|
vars:
|
||||||
|
index_pattern: heartbeat-*
|
||||||
|
@ -62,6 +62,21 @@
|
|||||||
- journal_dir.stat.exists | bool
|
- journal_dir.stat.exists | bool
|
||||||
- ansible_service_mgr == 'systemd'
|
- ansible_service_mgr == 'systemd'
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- beat-install
|
||||||
|
|
||||||
|
- name: Setup journalbeat rollup
|
||||||
|
hosts: elastic-logstash[0]
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
haproxy_ssl: false
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/variables.yml
|
||||||
|
|
||||||
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
- role: elastic_rollup
|
- role: elastic_rollup
|
||||||
when:
|
when:
|
||||||
- journal_dir.stat.exists | bool
|
- journal_dir.stat.exists | bool
|
||||||
@ -69,4 +84,4 @@
|
|||||||
index_name: journalbeat
|
index_name: journalbeat
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- beat-install
|
- journalbeat
|
||||||
|
@ -24,8 +24,28 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: elastic_metricbeat
|
- role: elastic_metricbeat
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- beat-install
|
||||||
|
|
||||||
|
- name: Setup metricbeat rollup
|
||||||
|
hosts: elastic-logstash[0]
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
haproxy_ssl: false
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/variables.yml
|
||||||
|
|
||||||
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
- role: elastic_rollup
|
- role: elastic_rollup
|
||||||
index_name: metricbeat
|
index_name: metricbeat
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- beat-install
|
- metricbeat
|
||||||
|
|
||||||
|
- import_playbook: fieldRefresh.yml
|
||||||
|
vars:
|
||||||
|
index_pattern: metricbeat-*
|
||||||
|
@ -24,8 +24,28 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: elastic_packetbeat
|
- role: elastic_packetbeat
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- beat-install
|
||||||
|
|
||||||
|
- name: Setup packetbeat rollup
|
||||||
|
hosts: elastic-logstash[0]
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
haproxy_ssl: false
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/variables.yml
|
||||||
|
|
||||||
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
- role: elastic_rollup
|
- role: elastic_rollup
|
||||||
index_name: packetbeat
|
index_name: packetbeat
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- beat-install
|
- packetbeat
|
||||||
|
|
||||||
|
- import_playbook: fieldRefresh.yml
|
||||||
|
vars:
|
||||||
|
index_pattern: packetbeat-*
|
||||||
|
@ -69,9 +69,14 @@
|
|||||||
notify:
|
notify:
|
||||||
- Enable and restart apm server
|
- Enable and restart apm server
|
||||||
|
|
||||||
- include_tasks: apm_setup.yml
|
- name: Run the beat setup role
|
||||||
tags:
|
include_role:
|
||||||
- setup
|
name: elastic_beat_setup
|
||||||
|
private: true
|
||||||
|
when:
|
||||||
|
- (groups['kibana'] | length) > 0
|
||||||
|
vars:
|
||||||
|
elastic_beat_name: "apm-server"
|
||||||
|
|
||||||
- name: Force beat handlers
|
- name: Force beat handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
@ -137,7 +137,9 @@ apm-server:
|
|||||||
{{ elk_macros.setup_template('apm', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
{{ elk_macros.setup_template('apm', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
||||||
|
|
||||||
#============================== Kibana =====================================
|
#============================== Kibana =====================================
|
||||||
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] + ':' + kibana_port|string) }}
|
{% if (groups['kibana'] | length) > 0 %}
|
||||||
|
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] ~ ':' ~ kibana_port) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
#================================ Logging ======================================
|
#================================ Logging ======================================
|
||||||
{{ elk_macros.beat_logging('apm-server') }}
|
{{ elk_macros.beat_logging('apm-server') }}
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
# 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: Refresh local facts
|
|
||||||
setup:
|
|
||||||
filter: ansible_local
|
|
||||||
gather_subset: "!all"
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Load templates
|
|
||||||
shell: >-
|
|
||||||
auditbeat setup
|
|
||||||
{{ item }}
|
|
||||||
-E 'output.logstash.enabled=false'
|
|
||||||
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
|
|
||||||
-E 'setup.template.enabled=true'
|
|
||||||
-E 'setup.template.overwrite=true'
|
|
||||||
-e -v
|
|
||||||
with_items:
|
|
||||||
- "--template"
|
|
||||||
- "--pipelines"
|
|
||||||
- "--machine-learning"
|
|
||||||
- "--dashboards"
|
|
||||||
register: templates
|
|
||||||
environment:
|
|
||||||
no_proxy: "{{ hostvars[groups['kibana'][0]]['ansible_host'] }}"
|
|
||||||
until: templates is success
|
|
||||||
retries: 5
|
|
||||||
delay: 5
|
|
||||||
run_once: true
|
|
||||||
when:
|
|
||||||
- ((ansible_local['elastic']['setup']['auditbeat_loaded_templates'] is undefined) or
|
|
||||||
(not (ansible_local['elastic']['setup']['auditbeat_loaded_templates'] | bool))) or
|
|
||||||
(elk_package_state | default('present')) == "latest"
|
|
||||||
tags:
|
|
||||||
- setup
|
|
||||||
|
|
||||||
- name: Set template fact
|
|
||||||
ini_file:
|
|
||||||
dest: "/etc/ansible/facts.d/elastic.fact"
|
|
||||||
section: "setup"
|
|
||||||
option: auditbeat_loaded_templates
|
|
||||||
value: true
|
|
||||||
when:
|
|
||||||
- templates is changed
|
|
||||||
tags:
|
|
||||||
- setup
|
|
@ -82,9 +82,14 @@
|
|||||||
notify:
|
notify:
|
||||||
- Enable and restart auditbeat
|
- Enable and restart auditbeat
|
||||||
|
|
||||||
- include_tasks: auditbeat_setup.yml
|
- name: Run the beat setup role
|
||||||
tags:
|
include_role:
|
||||||
- setup
|
name: elastic_beat_setup
|
||||||
|
private: true
|
||||||
|
when:
|
||||||
|
- (groups['kibana'] | length) > 0
|
||||||
|
vars:
|
||||||
|
elastic_beat_name: "auditbeat"
|
||||||
|
|
||||||
- name: Force beat handlers
|
- name: Force beat handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
@ -666,7 +666,9 @@ processors:
|
|||||||
{{ elk_macros.setup_template('auditbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
{{ elk_macros.setup_template('auditbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
||||||
|
|
||||||
#============================== Kibana =====================================
|
#============================== Kibana =====================================
|
||||||
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] + ':' + kibana_port|string) }}
|
{% if (groups['kibana'] | length) > 0 %}
|
||||||
|
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] ~ ':' ~ kibana_port) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
#================================ Logging ======================================
|
#================================ Logging ======================================
|
||||||
{{ elk_macros.beat_logging('auditbeat') }}
|
{{ elk_macros.beat_logging('auditbeat') }}
|
||||||
|
31
elk_metrics_6x/roles/elastic_beat_setup/defaults/main.yml
Normal file
31
elk_metrics_6x/roles/elastic_beat_setup/defaults/main.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Each setup flag is run one at a time.
|
||||||
|
elastic_setup_flags:
|
||||||
|
- "--template"
|
||||||
|
- "--pipelines"
|
||||||
|
- "--machine-learning"
|
||||||
|
- "--dashboards"
|
||||||
|
|
||||||
|
# Setup options are cast as a string with, one option per line.
|
||||||
|
elastic_beat_setup_options: >-
|
||||||
|
-E 'output.logstash.enabled=false'
|
||||||
|
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
|
||||||
|
-E 'setup.template.enabled=true'
|
||||||
|
-E 'setup.template.overwrite=true'
|
||||||
|
|
||||||
|
# The node defined here will be used with the environment variable, "no_proxy".
|
||||||
|
elastic_beat_kibana_host: "{{ hostvars[groups['kibana'][0]]['ansible_host'] }}"
|
35
elk_metrics_6x/roles/elastic_beat_setup/meta/main.yml
Normal file
35
elk_metrics_6x/roles/elastic_beat_setup/meta/main.yml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
author: OpenStack
|
||||||
|
description: Elastic v6.x repositories role
|
||||||
|
company: Rackspace
|
||||||
|
license: Apache2
|
||||||
|
min_ansible_version: 2.5
|
||||||
|
platforms:
|
||||||
|
- name: Ubuntu
|
||||||
|
versions:
|
||||||
|
- trusty
|
||||||
|
- xenial
|
||||||
|
- bionic
|
||||||
|
categories:
|
||||||
|
- cloud
|
||||||
|
- development
|
||||||
|
- beats
|
||||||
|
- elastic-beats
|
||||||
|
- elasticsearch
|
||||||
|
- elastic-stack
|
||||||
|
dependencies: []
|
@ -13,6 +13,20 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Check for coordination_nodes var
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
To use this role the variable `coordination_nodes` must be defined.
|
||||||
|
when:
|
||||||
|
- coordination_nodes is undefined
|
||||||
|
|
||||||
|
- name: Check for elastic_beat_name var
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
To use this role the variable `elastic_beat_name` must be defined.
|
||||||
|
when:
|
||||||
|
- elastic_beat_name is undefined
|
||||||
|
|
||||||
- name: Refresh local facts
|
- name: Refresh local facts
|
||||||
setup:
|
setup:
|
||||||
filter: ansible_local
|
filter: ansible_local
|
||||||
@ -22,28 +36,21 @@
|
|||||||
|
|
||||||
- name: Load templates
|
- name: Load templates
|
||||||
shell: >-
|
shell: >-
|
||||||
apm-server setup
|
{{ elastic_beat_name }} setup
|
||||||
{{ item }}
|
{{ item }}
|
||||||
-E 'apm-server.host=localhost:8200'
|
{{ elastic_beat_setup_options }}
|
||||||
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
|
|
||||||
-E 'setup.template.enabled=true'
|
|
||||||
-E 'setup.template.overwrite=true'
|
|
||||||
-e -v
|
-e -v
|
||||||
with_items:
|
with_items: "{{ elastic_setup_flags }}"
|
||||||
- "--template"
|
|
||||||
- "--pipelines"
|
|
||||||
- "--machine-learning"
|
|
||||||
- "--dashboards"
|
|
||||||
register: templates
|
register: templates
|
||||||
environment:
|
environment:
|
||||||
no_proxy: "{{ hostvars[groups['kibana'][0]]['ansible_host'] }}"
|
no_proxy: "{{ elastic_beat_kibana_host }}"
|
||||||
until: templates is success
|
until: templates is success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 5
|
delay: 5
|
||||||
run_once: true
|
run_once: true
|
||||||
when:
|
when:
|
||||||
- ((ansible_local['elastic']['setup']['apm_loaded_templates'] is undefined) or
|
- ((ansible_local['elastic']['setup'][elastic_beat_name + '_loaded_templates'] is undefined) or
|
||||||
(not (ansible_local['elastic']['setup']['apm_loaded_templates'] | bool))) or
|
(not (ansible_local['elastic']['setup'][elastic_beat_name + '_loaded_templates'] | bool))) or
|
||||||
(elk_package_state | default('present')) == "latest"
|
(elk_package_state | default('present')) == "latest"
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- setup
|
||||||
@ -52,7 +59,7 @@
|
|||||||
ini_file:
|
ini_file:
|
||||||
dest: "/etc/ansible/facts.d/elastic.fact"
|
dest: "/etc/ansible/facts.d/elastic.fact"
|
||||||
section: "setup"
|
section: "setup"
|
||||||
option: apm_loaded_templates
|
option: "{{ elastic_beat_name + '_loaded_templates' }}"
|
||||||
value: true
|
value: true
|
||||||
when:
|
when:
|
||||||
- templates is changed
|
- templates is changed
|
@ -121,9 +121,14 @@ master_nodes: |-
|
|||||||
{{ nodes }}
|
{{ nodes }}
|
||||||
master_node_count: "{{ master_nodes | length }}"
|
master_node_count: "{{ master_nodes | length }}"
|
||||||
|
|
||||||
coordination_nodes: >-
|
coordination_nodes: |-
|
||||||
|
{% if (groups['kibana'] | length) > 0 %}
|
||||||
|
{% set c_nodes = groups['kibana'] %}
|
||||||
|
{% else %}
|
||||||
|
{% set c_nodes = groups['elastic-logstash'] %}
|
||||||
|
{% endif %}
|
||||||
{{
|
{{
|
||||||
(groups['kibana'] | map('extract', hostvars, 'ansible_host') | list)
|
(c_nodes | map('extract', hostvars, 'ansible_host') | list)
|
||||||
| map('regex_replace', '(.*)' ,'\1:' ~ elastic_port)
|
| map('regex_replace', '(.*)' ,'\1:' ~ elastic_port)
|
||||||
| list
|
| list
|
||||||
}}
|
}}
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
# 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: Refresh local facts
|
|
||||||
setup:
|
|
||||||
filter: ansible_local
|
|
||||||
gather_subset: "!all"
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Load templates
|
|
||||||
shell: >-
|
|
||||||
filebeat setup
|
|
||||||
{{ item }}
|
|
||||||
-E 'output.logstash.enabled=false'
|
|
||||||
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
|
|
||||||
-E 'setup.template.enabled=true'
|
|
||||||
-E 'setup.template.overwrite=true'
|
|
||||||
-e -v
|
|
||||||
with_items:
|
|
||||||
- "--template"
|
|
||||||
- "--pipelines"
|
|
||||||
- "--machine-learning"
|
|
||||||
- "--dashboards"
|
|
||||||
register: templates
|
|
||||||
environment:
|
|
||||||
no_proxy: "{{ hostvars[groups['kibana'][0]]['ansible_host'] }}"
|
|
||||||
until: templates is success
|
|
||||||
retries: 5
|
|
||||||
delay: 5
|
|
||||||
run_once: true
|
|
||||||
when:
|
|
||||||
- ((ansible_local['elastic']['setup']['filebeat_loaded_templates'] is undefined) or
|
|
||||||
(not (ansible_local['elastic']['setup']['filebeat_loaded_templates'] | bool))) or
|
|
||||||
(elk_package_state | default('present')) == "latest"
|
|
||||||
tags:
|
|
||||||
- setup
|
|
||||||
|
|
||||||
- name: Set template fact
|
|
||||||
ini_file:
|
|
||||||
dest: "/etc/ansible/facts.d/elastic.fact"
|
|
||||||
section: "setup"
|
|
||||||
option: filebeat_loaded_templates
|
|
||||||
value: true
|
|
||||||
when:
|
|
||||||
- templates is changed
|
|
||||||
tags:
|
|
||||||
- setup
|
|
@ -82,9 +82,14 @@
|
|||||||
notify:
|
notify:
|
||||||
- Enable and restart filebeat
|
- Enable and restart filebeat
|
||||||
|
|
||||||
- include_tasks: filebeat_setup.yml
|
- name: Run the beat setup role
|
||||||
tags:
|
include_role:
|
||||||
- setup
|
name: elastic_beat_setup
|
||||||
|
private: true
|
||||||
|
when:
|
||||||
|
- (groups['kibana'] | length) > 0
|
||||||
|
vars:
|
||||||
|
elastic_beat_name: "filebeat"
|
||||||
|
|
||||||
- name: Force beat handlers
|
- name: Force beat handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
@ -912,7 +912,9 @@ processors:
|
|||||||
{{ elk_macros.setup_template('filebeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
{{ elk_macros.setup_template('filebeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
||||||
|
|
||||||
#============================== Kibana =====================================
|
#============================== Kibana =====================================
|
||||||
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] + ':' + kibana_port|string) }}
|
{% if (groups['kibana'] | length) > 0 %}
|
||||||
|
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] ~ ':' ~ kibana_port) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
#================================ Logging ======================================
|
#================================ Logging ======================================
|
||||||
{{ elk_macros.beat_logging('filebeat') }}
|
{{ elk_macros.beat_logging('filebeat') }}
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
# 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: Refresh local facts
|
|
||||||
setup:
|
|
||||||
filter: ansible_local
|
|
||||||
gather_subset: "!all"
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Load templates
|
|
||||||
shell: >-
|
|
||||||
heartbeat setup
|
|
||||||
{{ item }}
|
|
||||||
-E 'output.logstash.enabled=false'
|
|
||||||
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
|
|
||||||
-E 'setup.template.enabled=true'
|
|
||||||
-E 'setup.template.overwrite=true'
|
|
||||||
-e -v
|
|
||||||
with_items:
|
|
||||||
- "--template"
|
|
||||||
- "--pipelines"
|
|
||||||
- "--machine-learning"
|
|
||||||
- "--dashboards"
|
|
||||||
register: templates
|
|
||||||
environment:
|
|
||||||
no_proxy: "{{ hostvars[groups['kibana'][0]]['ansible_host'] }}"
|
|
||||||
until: templates is success
|
|
||||||
retries: 5
|
|
||||||
delay: 5
|
|
||||||
run_once: true
|
|
||||||
when:
|
|
||||||
- ((ansible_local['elastic']['setup']['heartbeat_loaded_templates'] is undefined) or
|
|
||||||
(not (ansible_local['elastic']['setup']['heartbeat_loaded_templates'] | bool))) or
|
|
||||||
(elk_package_state | default('present')) == "latest"
|
|
||||||
tags:
|
|
||||||
- setup
|
|
||||||
|
|
||||||
- name: Set template fact
|
|
||||||
ini_file:
|
|
||||||
dest: "/etc/ansible/facts.d/elastic.fact"
|
|
||||||
section: "setup"
|
|
||||||
option: heartbeat_loaded_templates
|
|
||||||
value: true
|
|
||||||
when:
|
|
||||||
- templates is changed
|
|
||||||
tags:
|
|
||||||
- setup
|
|
@ -88,9 +88,14 @@
|
|||||||
notify:
|
notify:
|
||||||
- Enable and restart heartbeat
|
- Enable and restart heartbeat
|
||||||
|
|
||||||
- include_tasks: heartbeat_setup.yml
|
- name: Run the beat setup role
|
||||||
tags:
|
include_role:
|
||||||
- setup
|
name: elastic_beat_setup
|
||||||
|
private: true
|
||||||
|
when:
|
||||||
|
- (groups['kibana'] | length) > 0
|
||||||
|
vars:
|
||||||
|
elastic_beat_name: "heartbeat"
|
||||||
|
|
||||||
- name: Force beat handlers
|
- name: Force beat handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
@ -780,7 +780,9 @@ processors:
|
|||||||
{{ elk_macros.setup_template('heartbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
{{ elk_macros.setup_template('heartbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
||||||
|
|
||||||
#============================== Kibana =====================================
|
#============================== Kibana =====================================
|
||||||
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] + ':' + kibana_port|string) }}
|
{% if (groups['kibana'] | length) > 0 %}
|
||||||
|
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] ~ ':' ~ kibana_port) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
#================================ Logging ======================================
|
#================================ Logging ======================================
|
||||||
{{ elk_macros.beat_logging('heartbeat') }}
|
{{ elk_macros.beat_logging('heartbeat') }}
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
# 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: Refresh local facts
|
|
||||||
setup:
|
|
||||||
filter: ansible_local
|
|
||||||
gather_subset: "!all"
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Load templates
|
|
||||||
shell: >-
|
|
||||||
journalbeat setup
|
|
||||||
{{ item }}
|
|
||||||
-E 'output.logstash.enabled=false'
|
|
||||||
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
|
|
||||||
-E 'setup.template.enabled=true'
|
|
||||||
-E 'setup.template.overwrite=true'
|
|
||||||
-e -v
|
|
||||||
with_items:
|
|
||||||
- "--template"
|
|
||||||
- "--pipelines"
|
|
||||||
- "--machine-learning"
|
|
||||||
- "--dashboards"
|
|
||||||
register: templates
|
|
||||||
environment:
|
|
||||||
no_proxy: "{{ hostvars[groups['kibana'][0]]['ansible_host'] }}"
|
|
||||||
until: templates is success
|
|
||||||
retries: 5
|
|
||||||
delay: 5
|
|
||||||
run_once: true
|
|
||||||
when:
|
|
||||||
- ((ansible_local['elastic']['setup']['journalbeat_loaded_templates'] is undefined) or
|
|
||||||
(not (ansible_local['elastic']['setup']['journalbeat_loaded_templates'] | bool))) or
|
|
||||||
(elk_package_state | default('present')) == "latest"
|
|
||||||
tags:
|
|
||||||
- setup
|
|
||||||
|
|
||||||
- name: Set template fact
|
|
||||||
ini_file:
|
|
||||||
dest: "/etc/ansible/facts.d/elastic.fact"
|
|
||||||
section: "setup"
|
|
||||||
option: journalbeat_loaded_templates
|
|
||||||
value: true
|
|
||||||
when:
|
|
||||||
- templates is changed
|
|
||||||
tags:
|
|
||||||
- setup
|
|
@ -88,9 +88,14 @@
|
|||||||
notify:
|
notify:
|
||||||
- Enable and restart journalbeat
|
- Enable and restart journalbeat
|
||||||
|
|
||||||
- include_tasks: journalbeat_setup.yml
|
- name: Run the beat setup role
|
||||||
tags:
|
include_role:
|
||||||
- setup
|
name: elastic_beat_setup
|
||||||
|
private: true
|
||||||
|
when:
|
||||||
|
- (groups['kibana'] | length) > 0
|
||||||
|
vars:
|
||||||
|
elastic_beat_name: "journalbeat"
|
||||||
|
|
||||||
- name: Force beat handlers
|
- name: Force beat handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
@ -579,7 +579,9 @@ tags:
|
|||||||
{{ elk_macros.setup_template('journalbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
{{ elk_macros.setup_template('journalbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
||||||
|
|
||||||
#============================== Kibana =====================================
|
#============================== Kibana =====================================
|
||||||
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] + ':' + kibana_port|string) }}
|
{% if (groups['kibana'] | length) > 0 %}
|
||||||
|
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] ~ ':' ~ kibana_port) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
#================================ Logging ======================================
|
#================================ Logging ======================================
|
||||||
{{ elk_macros.beat_logging('journalbeat') }}
|
{{ elk_macros.beat_logging('journalbeat') }}
|
||||||
|
@ -305,9 +305,14 @@
|
|||||||
notify:
|
notify:
|
||||||
- Enable and restart metricbeat
|
- Enable and restart metricbeat
|
||||||
|
|
||||||
- include_tasks: metricbeat_setup.yml
|
- name: Run the beat setup role
|
||||||
tags:
|
include_role:
|
||||||
- setup
|
name: elastic_beat_setup
|
||||||
|
private: true
|
||||||
|
when:
|
||||||
|
- (groups['kibana'] | length) > 0
|
||||||
|
vars:
|
||||||
|
elastic_beat_name: "metricbeat"
|
||||||
|
|
||||||
- name: Force beat handlers
|
- name: Force beat handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
# 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: Refresh local facts
|
|
||||||
setup:
|
|
||||||
filter: ansible_local
|
|
||||||
gather_subset: "!all"
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Load templates
|
|
||||||
shell: >-
|
|
||||||
metricbeat setup
|
|
||||||
{{ item }}
|
|
||||||
-E 'output.logstash.enabled=false'
|
|
||||||
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
|
|
||||||
-E 'setup.template.enabled=true'
|
|
||||||
-E 'setup.template.overwrite=true'
|
|
||||||
-e -v
|
|
||||||
with_items:
|
|
||||||
- "--template"
|
|
||||||
- "--pipelines"
|
|
||||||
- "--machine-learning"
|
|
||||||
- "--dashboards"
|
|
||||||
register: templates
|
|
||||||
environment:
|
|
||||||
no_proxy: "{{ hostvars[groups['kibana'][0]]['ansible_host'] }}"
|
|
||||||
until: templates is success
|
|
||||||
retries: 5
|
|
||||||
delay: 5
|
|
||||||
run_once: true
|
|
||||||
when:
|
|
||||||
- ((ansible_local['elastic']['setup']['metricbeat_loaded_templates'] is undefined) or
|
|
||||||
(not (ansible_local['elastic']['setup']['metricbeat_loaded_templates'] | bool))) or
|
|
||||||
(elk_package_state | default('present')) == "latest"
|
|
||||||
tags:
|
|
||||||
- setup
|
|
||||||
|
|
||||||
- name: Set template fact
|
|
||||||
ini_file:
|
|
||||||
dest: "/etc/ansible/facts.d/elastic.fact"
|
|
||||||
section: "setup"
|
|
||||||
option: metricbeat_loaded_templates
|
|
||||||
value: true
|
|
||||||
when:
|
|
||||||
- templates is changed
|
|
||||||
tags:
|
|
||||||
- setup
|
|
@ -1102,7 +1102,9 @@ processors:
|
|||||||
{{ elk_macros.setup_template('metricbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
{{ elk_macros.setup_template('metricbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
||||||
|
|
||||||
#================================ Kibana =======================================
|
#================================ Kibana =======================================
|
||||||
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] + ':' + kibana_port|string) }}
|
{% if (groups['kibana'] | length) > 0 %}
|
||||||
|
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] ~ ':' ~ kibana_port) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
#================================ Logging ======================================
|
#================================ Logging ======================================
|
||||||
{{ elk_macros.beat_logging('metricbeat') }}
|
{{ elk_macros.beat_logging('metricbeat') }}
|
||||||
|
@ -73,9 +73,14 @@
|
|||||||
notify:
|
notify:
|
||||||
- Enable and restart packetbeat
|
- Enable and restart packetbeat
|
||||||
|
|
||||||
- include_tasks: packetbeat_setup.yml
|
- name: Run the beat setup role
|
||||||
tags:
|
include_role:
|
||||||
- setup
|
name: elastic_beat_setup
|
||||||
|
private: true
|
||||||
|
when:
|
||||||
|
- (groups['kibana'] | length) > 0
|
||||||
|
vars:
|
||||||
|
elastic_beat_name: "packetbeat"
|
||||||
|
|
||||||
- name: Force beat handlers
|
- name: Force beat handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
# 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: Refresh local facts
|
|
||||||
setup:
|
|
||||||
filter: ansible_local
|
|
||||||
gather_subset: "!all"
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Load templates
|
|
||||||
shell: >-
|
|
||||||
packetbeat setup
|
|
||||||
{{ item }}
|
|
||||||
-E 'output.logstash.enabled=false'
|
|
||||||
-E 'output.elasticsearch.hosts={{ coordination_nodes | to_json }}'
|
|
||||||
-E 'setup.template.enabled=true'
|
|
||||||
-E 'setup.template.overwrite=true'
|
|
||||||
-e -v
|
|
||||||
with_items:
|
|
||||||
- "--template"
|
|
||||||
- "--pipelines"
|
|
||||||
- "--machine-learning"
|
|
||||||
- "--dashboards"
|
|
||||||
register: templates
|
|
||||||
environment:
|
|
||||||
no_proxy: "{{ hostvars[groups['kibana'][0]]['ansible_host'] }}"
|
|
||||||
until: templates is success
|
|
||||||
retries: 5
|
|
||||||
delay: 5
|
|
||||||
run_once: true
|
|
||||||
when:
|
|
||||||
- ((ansible_local['elastic']['setup']['packetbeat_loaded_templates'] is undefined) or
|
|
||||||
(not (ansible_local['elastic']['setup']['packetbeat_loaded_templates'] | bool))) or
|
|
||||||
(elk_package_state | default('present')) == "latest"
|
|
||||||
tags:
|
|
||||||
- setup
|
|
||||||
|
|
||||||
- name: Set template fact
|
|
||||||
ini_file:
|
|
||||||
dest: "/etc/ansible/facts.d/elastic.fact"
|
|
||||||
section: "setup"
|
|
||||||
option: packetbeat_loaded_templates
|
|
||||||
value: true
|
|
||||||
when:
|
|
||||||
- templates is changed
|
|
||||||
tags:
|
|
||||||
- setup
|
|
@ -1056,7 +1056,9 @@ processors:
|
|||||||
{{ elk_macros.setup_template('packetbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
{{ elk_macros.setup_template('packetbeat', inventory_hostname, data_nodes, elasticsearch_number_of_replicas) }}
|
||||||
|
|
||||||
#================================ Kibana =======================================
|
#================================ Kibana =======================================
|
||||||
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] + ':' + kibana_port|string) }}
|
{% if (groups['kibana'] | length) > 0 %}
|
||||||
|
{{ elk_macros.setup_kibana(hostvars[groups['kibana'][0]]['ansible_host'] ~ ':' ~ kibana_port) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
#================================ Logging ======================================
|
#================================ Logging ======================================
|
||||||
{{ elk_macros.beat_logging('packetbeat') }}
|
{{ elk_macros.beat_logging('packetbeat') }}
|
||||||
|
@ -12,28 +12,13 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- import_playbook: installMetricbeat.yml
|
- import_playbook: installMetricbeat.yml
|
||||||
- import_playbook: fieldRefresh.yml
|
|
||||||
vars:
|
|
||||||
index_pattern: metricbeat-*
|
|
||||||
|
|
||||||
- import_playbook: installPacketbeat.yml
|
- import_playbook: installPacketbeat.yml
|
||||||
- import_playbook: fieldRefresh.yml
|
|
||||||
vars:
|
|
||||||
index_pattern: packetbeat-*
|
|
||||||
|
|
||||||
- import_playbook: installAuditbeat.yml
|
- import_playbook: installAuditbeat.yml
|
||||||
- import_playbook: fieldRefresh.yml
|
|
||||||
vars:
|
|
||||||
index_pattern: auditbeat-*
|
|
||||||
|
|
||||||
- import_playbook: installHeartbeat.yml
|
- import_playbook: installHeartbeat.yml
|
||||||
- import_playbook: fieldRefresh.yml
|
|
||||||
vars:
|
|
||||||
index_pattern: heartbeat-*
|
|
||||||
|
|
||||||
- import_playbook: installFilebeat.yml
|
- import_playbook: installFilebeat.yml
|
||||||
- import_playbook: fieldRefresh.yml
|
|
||||||
vars:
|
|
||||||
index_pattern: filebeat-*
|
|
||||||
|
|
||||||
- import_playbook: installJournalbeat.yml
|
- import_playbook: installJournalbeat.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user