diff --git a/elk_metrics_6x/common_task_data_node_hosts.yml b/elk_metrics_6x/common_task_data_node_hosts.yml index ffd65a3a..5b4eedc2 100644 --- a/elk_metrics_6x/common_task_data_node_hosts.yml +++ b/elk_metrics_6x/common_task_data_node_hosts.yml @@ -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 diff --git a/elk_metrics_6x/installAPMserver.yml b/elk_metrics_6x/installAPMserver.yml index 9952f9ee..62ab1235 100644 --- a/elk_metrics_6x/installAPMserver.yml +++ b/elk_metrics_6x/installAPMserver.yml @@ -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 diff --git a/elk_metrics_6x/installAuditbeat.yml b/elk_metrics_6x/installAuditbeat.yml index 0feb1d93..574b6628 100644 --- a/elk_metrics_6x/installAuditbeat.yml +++ b/elk_metrics_6x/installAuditbeat.yml @@ -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 diff --git a/elk_metrics_6x/installCurator.yml b/elk_metrics_6x/installCurator.yml index 7073f2ae..c57d131f 100644 --- a/elk_metrics_6x/installCurator.yml +++ b/elk_metrics_6x/installCurator.yml @@ -119,3 +119,6 @@ name: "curator.timer" enabled: true state: restarted + + tags: + - beat-install diff --git a/elk_metrics_6x/installElastic.yml b/elk_metrics_6x/installElastic.yml index 0fcea462..7c2c9f3d 100644 --- a/elk_metrics_6x/installElastic.yml +++ b/elk_metrics_6x/installElastic.yml @@ -126,3 +126,6 @@ state: restarted tags: - config + + tags: + - server-install diff --git a/elk_metrics_6x/installFilebeat.yml b/elk_metrics_6x/installFilebeat.yml index 99afd71a..1930d4c1 100644 --- a/elk_metrics_6x/installFilebeat.yml +++ b/elk_metrics_6x/installFilebeat.yml @@ -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 diff --git a/elk_metrics_6x/installHeartbeat.yml b/elk_metrics_6x/installHeartbeat.yml index 3ea05f94..2d5a8ff7 100644 --- a/elk_metrics_6x/installHeartbeat.yml +++ b/elk_metrics_6x/installHeartbeat.yml @@ -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 diff --git a/elk_metrics_6x/installJournalbeat.yml b/elk_metrics_6x/installJournalbeat.yml index db66c62f..04424b0b 100644 --- a/elk_metrics_6x/installJournalbeat.yml +++ b/elk_metrics_6x/installJournalbeat.yml @@ -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 diff --git a/elk_metrics_6x/installKibana.yml b/elk_metrics_6x/installKibana.yml index 603578f7..65245120 100644 --- a/elk_metrics_6x/installKibana.yml +++ b/elk_metrics_6x/installKibana.yml @@ -68,3 +68,6 @@ name: "kibana" enabled: true state: restarted + + tags: + - server-install diff --git a/elk_metrics_6x/installLogstash.yml b/elk_metrics_6x/installLogstash.yml index 8a492c52..98ad4d2c 100644 --- a/elk_metrics_6x/installLogstash.yml +++ b/elk_metrics_6x/installLogstash.yml @@ -169,3 +169,6 @@ name: "logstash" enabled: true state: restarted + + tags: + - server-install diff --git a/elk_metrics_6x/installMetricbeat.yml b/elk_metrics_6x/installMetricbeat.yml index dab6622b..a1bc2616 100644 --- a/elk_metrics_6x/installMetricbeat.yml +++ b/elk_metrics_6x/installMetricbeat.yml @@ -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 diff --git a/elk_metrics_6x/installPacketbeat.yml b/elk_metrics_6x/installPacketbeat.yml index 2ae59f63..2ad3c7a1 100644 --- a/elk_metrics_6x/installPacketbeat.yml +++ b/elk_metrics_6x/installPacketbeat.yml @@ -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 diff --git a/elk_metrics_6x/setupAPMserver.yml b/elk_metrics_6x/setupAPMserver.yml new file mode 100644 index 00000000..433d4b9f --- /dev/null +++ b/elk_metrics_6x/setupAPMserver.yml @@ -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 diff --git a/elk_metrics_6x/setupAuditbeat.yml b/elk_metrics_6x/setupAuditbeat.yml new file mode 100644 index 00000000..75e6a0bb --- /dev/null +++ b/elk_metrics_6x/setupAuditbeat.yml @@ -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 diff --git a/elk_metrics_6x/setupFilebeat.yml b/elk_metrics_6x/setupFilebeat.yml new file mode 100644 index 00000000..56644f94 --- /dev/null +++ b/elk_metrics_6x/setupFilebeat.yml @@ -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 diff --git a/elk_metrics_6x/setupHeartbeat.yml b/elk_metrics_6x/setupHeartbeat.yml new file mode 100644 index 00000000..0319f03b --- /dev/null +++ b/elk_metrics_6x/setupHeartbeat.yml @@ -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 diff --git a/elk_metrics_6x/setupJournalbeat.yml b/elk_metrics_6x/setupJournalbeat.yml new file mode 100644 index 00000000..192233d3 --- /dev/null +++ b/elk_metrics_6x/setupJournalbeat.yml @@ -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 diff --git a/elk_metrics_6x/setupMetricbeat.yml b/elk_metrics_6x/setupMetricbeat.yml new file mode 100644 index 00000000..c9fb9401 --- /dev/null +++ b/elk_metrics_6x/setupMetricbeat.yml @@ -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 diff --git a/elk_metrics_6x/setupPacketbeat.yml b/elk_metrics_6x/setupPacketbeat.yml new file mode 100644 index 00000000..3991858a --- /dev/null +++ b/elk_metrics_6x/setupPacketbeat.yml @@ -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