openstack-ansible-ops/elk_metrics_6x/roles/elastic_logstash/handlers/main.yml
Kevin Carter 0b0efcb841
Add capability to set node role
Presently the node role assignment is only automatic. Auto selection
makes the assumption every node is identical however in many deployments
a deployer may want to assign node roles to specific hardware thereby
optimizing resources and improving general performance. This change
adds and documents the ability to set the node roles within an ansible
inventory.

Change-Id: I22a2b636cb1441f17e575439b55ca64f9c7b0336
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-09-18 12:35:06 -05:00

34 lines
1.1 KiB
YAML

---
# 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: Enable and restart logstash (systemd)
systemd:
name: "logstash"
enabled: true
state: "{{ (inventory_hostname in logstash_nodes) | ternary('restarted', 'stopped') }}"
daemon_reload: true
when:
- ansible_service_mgr == 'systemd'
listen: Enable and restart logstash
- name: Enable and restart logstash (upstart)
service:
name: "logstash"
state: "{{ (inventory_hostname in logstash_nodes) | ternary('restarted', 'stopped') }}"
enabled: yes
when:
- ansible_service_mgr == 'upstart'
listen: Enable and restart logstash