---
- name: import elasticsearch gpg key
  apt_key:
    url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch"
    state: present

- name: Install required packages
  apt:
    name: apt-transport-https
    state: present

- name: add elastic repository
  apt_repository:
    repo: "deb https://artifacts.elastic.co/packages/8.x/apt stable main"
    state: present
    update_cache: yes

- name: install filebeat
  apt:
    name: filebeat
    state: present
    update_cache: yes
  register: result
  until: result is succeeded
  retries: 10
  delay: 10
