47 lines
1 KiB
YAML
47 lines
1 KiB
YAML
---
|
|
- name: Install dependencies packages
|
|
ansible.builtin.package:
|
|
name:
|
|
- apt-transport-https
|
|
retries: 2
|
|
register: result
|
|
until: result is succeeded
|
|
tags: filebeat
|
|
|
|
- name: Add repository key
|
|
ansible.builtin.apt_key:
|
|
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
|
|
retries: 2
|
|
register: result
|
|
until: result is succeeded
|
|
tags: filebeat
|
|
|
|
- name: Add repository
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb https://artifacts.elastic.co/packages/{{ filebeat_major_version }}.x/apt stable main"
|
|
tags: filebeat
|
|
|
|
- name: Install package
|
|
ansible.builtin.package:
|
|
name: filebeat
|
|
retries: 2
|
|
register: result
|
|
until: result is succeeded
|
|
tags: filebeat
|
|
|
|
- name: Copy config file
|
|
ansible.builtin.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
|
|
ansible.builtin.service:
|
|
name: filebeat
|
|
state: started
|
|
enabled: true
|
|
tags: filebeat
|