ansible-role-filebeat/tasks/main.yml
2019-11-08 21:34:52 +01:00

46 lines
948 B
YAML

---
- name: install dependencies packages
apt:
name: apt-transport-https
retries: 2
register: result
until: result is succeeded
tags: filebeat
- name: add repository key
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
retries: 2
register: result
until: result is succeeded
tags: filebeat
- name: add repository
apt_repository:
repo: 'deb https://artifacts.elastic.co/packages/{{ filebeat_major_version }}.x/apt stable main'
tags: filebeat
- name: install package
apt:
name: filebeat
retries: 2
register: result
until: result is succeeded
tags: filebeat
- name: copy config file
copy:
content: '{{ filebeat_config|to_yaml }}'
dest: /etc/filebeat/filebeat.yml
owner: root
group: root
mode: 0644
notify: restart filebeat
tags: filebeat
- name: enable and start service
systemd:
name: filebeat
state: started
enabled: true
tags: filebeat