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
This commit is contained in:
parent
94d8f09b74
commit
7430f6c8d5
16
elk_metrics_6x/roles/elastic_auditbeat/defaults/main.yml
Normal file
16
elk_metrics_6x/roles/elastic_auditbeat/defaults/main.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2018, Vexxhost, 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.
|
||||
|
||||
auditbeat_service_state: restarted
|
@ -17,7 +17,7 @@
|
||||
systemd:
|
||||
name: "auditbeat"
|
||||
enabled: true
|
||||
state: restarted
|
||||
state: "{{ auditbeat_service_state }}"
|
||||
daemon_reload: true
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
@ -26,7 +26,7 @@
|
||||
- name: Enable and restart auditbeat (upstart)
|
||||
service:
|
||||
name: "auditbeat"
|
||||
state: restarted
|
||||
state: "{{ auditbeat_service_state }}"
|
||||
enabled: yes
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
|
@ -73,3 +73,21 @@
|
||||
|
||||
- name: Force beat handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: set auditbeat service state (upstart)
|
||||
service:
|
||||
name: "auditbeat"
|
||||
state: "{{ auditbeat_service_state }}"
|
||||
enabled: "{{ auditbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
- auditbeat_service_state in ['started', 'stopped']
|
||||
|
||||
- name: set auditbeat service state (systemd)
|
||||
systemd:
|
||||
name: "auditbeat"
|
||||
state: "{{ auditbeat_service_state }}"
|
||||
enabled: "{{ auditbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
- auditbeat_service_state in ['started', 'stopped']
|
||||
|
16
elk_metrics_6x/roles/elastic_filebeat/defaults/main.yml
Normal file
16
elk_metrics_6x/roles/elastic_filebeat/defaults/main.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2018, Vexxhost, 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.
|
||||
|
||||
filebeat_service_state: restarted
|
@ -17,7 +17,7 @@
|
||||
systemd:
|
||||
name: "filebeat"
|
||||
enabled: true
|
||||
state: restarted
|
||||
state: "{{ filebeat_service_state }}"
|
||||
daemon_reload: true
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
@ -26,7 +26,7 @@
|
||||
- name: Enable and restart filebeat (upstart)
|
||||
service:
|
||||
name: "filebeat"
|
||||
state: restarted
|
||||
state: "{{ filebeat_service_state }}"
|
||||
enabled: yes
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
|
@ -183,3 +183,21 @@
|
||||
|
||||
- name: Force beat handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: set filebeat service state (upstart)
|
||||
service:
|
||||
name: "filebeat"
|
||||
state: "{{ filebeat_service_state }}"
|
||||
enabled: "{{ filebeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
- filebeat_service_state in ['started', 'stopped']
|
||||
|
||||
- name: set filebeat service state (systemd)
|
||||
systemd:
|
||||
name: "filebeat"
|
||||
state: "{{ filebeat_service_state }}"
|
||||
enabled: "{{ filebeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
- filebeat_service_state in ['started', 'stopped']
|
||||
|
16
elk_metrics_6x/roles/elastic_heartbeat/defaults/main.yml
Normal file
16
elk_metrics_6x/roles/elastic_heartbeat/defaults/main.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2018, Vexxhost, 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.
|
||||
|
||||
heartbeat_service_state: restarted
|
@ -17,7 +17,7 @@
|
||||
systemd:
|
||||
name: "heartbeat-elastic"
|
||||
enabled: true
|
||||
state: restarted
|
||||
state: "{{ heartbeat_service_state }}"
|
||||
daemon_reload: true
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
@ -26,7 +26,7 @@
|
||||
- name: Enable and restart heartbeat (upstart)
|
||||
service:
|
||||
name: "heartbeat-elastic"
|
||||
state: restarted
|
||||
state: "{{ heartbeat_service_state }}"
|
||||
enabled: yes
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
|
@ -79,3 +79,21 @@
|
||||
|
||||
- name: Force beat handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: set heartbeat service state (upstart)
|
||||
service:
|
||||
name: "heartbeat-elastic"
|
||||
state: "{{ heartbeat_service_state }}"
|
||||
enabled: "{{ heartbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
- heartbeat_service_state in ['started', 'stopped']
|
||||
|
||||
- name: set heartbeat service state (systemd)
|
||||
systemd:
|
||||
name: "heartbeat-elastic"
|
||||
state: "{{ heartbeat_service_state }}"
|
||||
enabled: "{{ heartbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
- heartbeat_service_state in ['started', 'stopped']
|
||||
|
16
elk_metrics_6x/roles/elastic_journalbeat/defaults/main.yml
Normal file
16
elk_metrics_6x/roles/elastic_journalbeat/defaults/main.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2018, Vexxhost, 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.
|
||||
|
||||
journalbeat_service_state: restarted
|
@ -17,7 +17,7 @@
|
||||
systemd:
|
||||
name: "journalbeat"
|
||||
enabled: true
|
||||
state: restarted
|
||||
state: "{{ journalbeat_service_state }}"
|
||||
daemon_reload: yes
|
||||
when:
|
||||
- (elk_package_state | default('present')) != 'absent'
|
||||
|
@ -145,3 +145,21 @@
|
||||
|
||||
- name: Force beat handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: set journalbeat service state (upstart)
|
||||
service:
|
||||
name: "journalbeat"
|
||||
state: "{{ journalbeat_service_state }}"
|
||||
enabled: "{{ journalbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
- journalbeat_service_state in ['started', 'stopped']
|
||||
|
||||
- name: set journalbeat service state (systemd)
|
||||
systemd:
|
||||
name: "journalbeat"
|
||||
state: "{{ journalbeat_service_state }}"
|
||||
enabled: "{{ journalbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
- journalbeat_service_state in ['started', 'stopped']
|
||||
|
@ -16,3 +16,5 @@
|
||||
#metricbeats monitoring endpoints
|
||||
elastic_metricbeat_rabbitmq_monitoring_hosts: '"localhost:15672"'
|
||||
elastic_metricbeat_haproxy_monitoring_hosts: '"unix:///var/run/haproxy.stat"'
|
||||
|
||||
metricbeat_service_state: restarted
|
||||
|
@ -17,7 +17,7 @@
|
||||
systemd:
|
||||
name: "metricbeat"
|
||||
enabled: true
|
||||
state: restarted
|
||||
state: "{{ metricbeat_service_state }}"
|
||||
daemon_reload: true
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
@ -26,7 +26,7 @@
|
||||
- name: Enable and restart metricbeat (upstart)
|
||||
service:
|
||||
name: "elasticsearch"
|
||||
state: restarted
|
||||
state: "{{ metricbeat_service_state }}"
|
||||
enabled: yes
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
|
@ -253,3 +253,21 @@
|
||||
|
||||
- name: Force beat handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: set metricbeat service state (upstart)
|
||||
service:
|
||||
name: "metricbeat"
|
||||
state: "{{ metricbeat_service_state }}"
|
||||
enabled: "{{ metricbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
- metricbeat_service_state in ['started', 'stopped']
|
||||
|
||||
- name: set metricbeat service state (systemd)
|
||||
systemd:
|
||||
name: "metricbeat"
|
||||
state: "{{ metricbeat_service_state }}"
|
||||
enabled: "{{ metricbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
- metricbeat_service_state in ['started', 'stopped']
|
||||
|
16
elk_metrics_6x/roles/elastic_packetbeat/defaults/main.yml
Normal file
16
elk_metrics_6x/roles/elastic_packetbeat/defaults/main.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2018, Vexxhost, 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.
|
||||
|
||||
packetbeat_service_state: restarted
|
@ -17,7 +17,7 @@
|
||||
systemd:
|
||||
name: "packetbeat"
|
||||
enabled: true
|
||||
state: restarted
|
||||
state: "{{ packetbeat_service_state }}"
|
||||
daemon_reload: true
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
@ -26,7 +26,7 @@
|
||||
- name: Enable and restart packetbeat (upstart)
|
||||
service:
|
||||
name: "elasticsearch"
|
||||
state: restarted
|
||||
state: "{{ packetbeat_service_state }}"
|
||||
enabled: yes
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
|
@ -77,3 +77,21 @@
|
||||
|
||||
- name: Force beat handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: set packetbeat service state (upstart)
|
||||
service:
|
||||
name: "packetbeat"
|
||||
state: "{{ packetbeat_service_state }}"
|
||||
enabled: "{{ packetbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'upstart'
|
||||
- packetbeat_service_state in ['started', 'stopped']
|
||||
|
||||
- name: set packetbeat service state (systemd)
|
||||
systemd:
|
||||
name: "packetbeat"
|
||||
state: "{{ packetbeat_service_state }}"
|
||||
enabled: "{{ packetbeat_service_state in ['running', 'started', 'restarted'] }}"
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
- packetbeat_service_state in ['started', 'stopped']
|
||||
|
Loading…
x
Reference in New Issue
Block a user