openstack-ansible-ops/elk_metrics_6x/roles/elastic_filebeat/handlers/main.yml
Guilherme Steinmüller 7430f6c8d5 Add variable to define a beat service state
This patch aims to provide the user a way to enable/disable
beats by overriding {beatname}_service_state variable accordingly
to the beats that the users wants to be receiving data.

There are some use cases that users just wants a subset of the
beats provided, mostly to avoid unecessary use of bandwidth
with data that woudn't be used. So the way that this patch proposes
this use case is just enable/disable after install, keeping the service
installed in case of the users needs it.

Change-Id: I2251095d7fcfc48a239fe9d4984269503cc835da
2018-09-20 16:27:20 +00:00

34 lines
1.0 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 filebeat (systemd)
systemd:
name: "filebeat"
enabled: true
state: "{{ filebeat_service_state }}"
daemon_reload: true
when:
- ansible_service_mgr == 'systemd'
listen: Enable and restart filebeat
- name: Enable and restart filebeat (upstart)
service:
name: "filebeat"
state: "{{ filebeat_service_state }}"
enabled: yes
when:
- ansible_service_mgr == 'upstart'
listen: Enable and restart filebeat