2019-11-08 20:34:52 +00:00
|
|
|
---
|
|
|
|
- name: install dependencies packages
|
2022-04-08 07:02:40 +00:00
|
|
|
ansible.builtin.package:
|
|
|
|
name:
|
|
|
|
- apt-transport-https
|
2019-11-08 20:34:52 +00:00
|
|
|
retries: 2
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
tags: filebeat
|
|
|
|
|
|
|
|
- name: add repository key
|
2022-04-08 07:02:40 +00:00
|
|
|
ansible.builtin.apt_key:
|
2019-11-08 20:34:52 +00:00
|
|
|
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
|
|
|
|
retries: 2
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
tags: filebeat
|
|
|
|
|
|
|
|
- name: add repository
|
2022-04-08 07:02:40 +00:00
|
|
|
ansible.builtin.apt_repository:
|
2019-11-08 20:34:52 +00:00
|
|
|
repo: 'deb https://artifacts.elastic.co/packages/{{ filebeat_major_version }}.x/apt stable main'
|
|
|
|
tags: filebeat
|
|
|
|
|
|
|
|
- name: install package
|
2022-04-08 07:02:40 +00:00
|
|
|
ansible.builtin.package:
|
2019-11-08 20:34:52 +00:00
|
|
|
name: filebeat
|
|
|
|
retries: 2
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
tags: filebeat
|
|
|
|
|
|
|
|
- name: copy config file
|
2022-04-08 07:02:40 +00:00
|
|
|
ansible.builtin.copy:
|
2019-11-08 20:34:52 +00:00
|
|
|
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
|
2022-04-08 07:02:40 +00:00
|
|
|
ansible.builtin.service:
|
2019-11-08 20:34:52 +00:00
|
|
|
name: filebeat
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
tags: filebeat
|