Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions filebeat/config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ filebeat.config:
- group: root
- mode: 644
- watch_in:
# unfortunately, filebeat is restarted by cmd until tty issues are resolved
- cmd: filebeat.service
- service: filebeat.service

{% if conf.runlevels_install %}
filebeat.runlevels_install:
Expand Down
2 changes: 1 addition & 1 deletion filebeat/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ filebeat_repo:
- pkg: filebeat.install
- watch_in:
- pkg: filebeat.install

{% elif salt['grains.get']('os_family') == 'RedHat' %}
filebeat_repo:
pkgrepo.managed:
Expand Down
22 changes: 3 additions & 19 deletions filebeat/service.sls
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
# filebeat 1.0.0 will not start without tty. use_vt in cmd.run, or sudo with !requiretty in sudoers (default) does not work.
# this is a hack to get around that issue.
filebeat.sshkeygen:
cmd.run:
- name: ssh-keygen -f /root/.ssh/filebeat -P ""
- unless:
- ls /root/.ssh/filebeat

filebeat.pubkeytoauth:
cmd.run:
- name: cat /root/.ssh/filebeat.pub >> /root/.ssh/authorized_keys
- unless: cat /root/.ssh/filebeat.pub | grep -f - /root/.ssh/authorized_keys
- require:
- cmd: filebeat.sshkeygen

filebeat.service:
cmd.run:
- name: ssh -t -t -o NoHostAuthenticationForLocalhost=yes -i /root/.ssh/filebeat root@localhost "su -c 'service filebeat restart'"
service.running:
- name: filebeat
- enable: True
- require:
- pkg: filebeat
- cmd: filebeat.sshkeygen
- cmd: filebeat.pubkeytoauth