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_type: logstash
filebeat_output_hosts: filebeat_output_hosts: []
- localhost:5044 # filebeat_output_hosts:
# - graylog.example.org:5044
filebeat_output_ssl: filebeat_output_ssl:
enabled: True enabled: True
# cert_authorities: # cert_authorities:

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

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

Loading…
Cancel
Save