Update to 2021-01-28 13:00

master
Daniel Berteaud 4 years ago
parent c70818804a
commit 92583e12d2
  1. 5
      roles/filebeat/defaults/main.yml
  2. 8
      roles/filebeat/handlers/main.yml
  3. 23
      roles/filebeat/tasks/main.yml

@ -1,7 +1,8 @@
---
filebeat_output_type: logstash
filebeat_output_hosts:
- localhost:5044
filebeat_output_hosts: []
# filebeat_output_hosts:
# - graylog.example.org:5044
filebeat_output_ssl:
enabled: True
# cert_authorities:

@ -1,8 +1,10 @@
---
- name: restart filebeat
service: name=filebeat state=restarted
when: filebeat_output_hosts | length > 0
- name: restart journalbeat
service:
name: journalbeat
state: "{{ (ansible_service_mgr == 'systemd') | ternary('restarted','stopped') }}"
service: name=journalbeat state=restarted
when:
- filebeat_output_hosts | length > 0
- ansible_service_mgr == 'systemd'

@ -1,7 +1,15 @@
---
- include_tasks: install_filebeat_{{ ansible_os_family }}.yml
- include_tasks: install_journalbeat_{{ ansible_os_family }}.yml
- name: Install filebeatbeat
package:
name:
- filebeat
tags: logs
- name: Install journalbeat
package:
name:
- journalbeat
when: ansible_service_mgr == 'systemd'
tags: logs
@ -52,13 +60,16 @@
when: filebeat_unit.changed or (filebeat_journalbeat_unit is defined and filebeat_journalbeat_unit.changed)
tags: logs
- name: Start and enable filebeat
service: name=filebeat state=started enabled=True
- name: Handle filebeat service
service:
name: filebeat
state: "{{ (filebeat_output_hosts | length > 0) | ternary('started','stopped') }}"
enabled: "{{ (filebeat_output_hosts | length > 0) | ternary(True,False) }}"
tags: logs
- name: Handle journalbeat service
service:
name: journalbeat
state: "{{ (ansible_service_mgr == 'systemd') | ternary('started','stopped') }}"
enabled: "{{ (ansible_service_mgr == 'systemd') | ternary(True,False) }} "
state: "{{ (ansible_service_mgr == 'systemd' and filebeat_output_hosts | length > 0) | ternary('started','stopped') }}"
enabled: "{{ (ansible_service_mgr == 'systemd' and filebeat_output_hosts | length > 0) | ternary(True,False) }} "
tags: logs

Loading…
Cancel
Save