Skip to content

Instantly share code, notes, and snippets.

@itsx
Last active July 29, 2020 08:00
Show Gist options
  • Save itsx/ab596ff53fbbd6c8693a60fff94d0757 to your computer and use it in GitHub Desktop.
Save itsx/ab596ff53fbbd6c8693a60fff94d0757 to your computer and use it in GitHub Desktop.
Filebeat install playbook (unfinished)
#################################################
# DO Community Playbooks: Filebeat
#################################################
---
- hosts: docker
become: true
vars_files:
#- vars/default.yml
tasks:
- name: Add filebeat apt GPG key to a keyring
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
state: present
when: false
- name: Add apt repository for filebeat
apt_repository:
repo: deb https://artifacts.elastic.co/packages/6.x/apt stable main
state: present
filename: /etc/apt/sources.list.d/elastic-6.x.list
debugger: on_failed
when: false
- name: Update apt
apt: update_cache=yes force_apt_get=yes state=latest
when: false
- name: Collect apt packages facts
package_facts:
manager: apt
no_log: true
- name: Check whether a package called filebeat is installed
debug:
msg: "{{ ansible_facts.packages['filebeat']}}"
when: "'filebeat' in ansible_facts.packages"
- name: Install filebeat 6.8.6 if not exist
apt:
name: filebeat=6.8.6
when: true
- name: enable service filebeat
systemd:
daemon_reload: yes
enabled: yes
name: filebeat
when: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment