ansible-role-filebeat/tasks/main.yml

53 lines
1.2 KiB
YAML
Raw Normal View History

2019-11-08 20:34:52 +00:00
---
2023-06-29 14:12:17 +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
2023-06-29 14:12:17 +00:00
- name: Add repository key
2024-02-16 09:26:11 +00:00
ansible.builtin.get_url:
2019-11-08 20:34:52 +00:00
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
2024-02-16 09:26:11 +00:00
dest: /etc/apt/keyrings/elastic.asc
owner: root
group: root
mode: 0644
checksum: sha256:db52809c5f6b27f9c2bed45cb43e398c659275f3d35305653c6750a0db90f5eb
2019-11-08 20:34:52 +00:00
tags: filebeat
2023-06-29 14:12:17 +00:00
- name: Add repository
2022-04-08 07:02:40 +00:00
ansible.builtin.apt_repository:
2024-02-16 09:26:11 +00:00
repo: >
deb [signed-by=/etc/apt/keyrings/elastic.asc]
https://artifacts.elastic.co/packages/{{ filebeat_major_version }}.x/apt stable main
filename: elastic
2019-11-08 20:34:52 +00:00
tags: filebeat
2023-06-29 14:12:17 +00:00
- 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
2023-06-29 14:12:17 +00:00
- name: Copy config file
2022-04-08 07:02:40 +00:00
ansible.builtin.copy:
2023-06-29 14:12:17 +00:00
content: "{{ filebeat_config | to_yaml }}"
2019-11-08 20:34:52 +00:00
dest: /etc/filebeat/filebeat.yml
owner: root
group: root
mode: 0644
2023-06-29 14:12:17 +00:00
notify: Restart filebeat
2019-11-08 20:34:52 +00:00
tags: filebeat
2023-06-29 14:12:17 +00:00
- 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