From 33212a95c3ada579f3c35f2dd8fce0313430e36e Mon Sep 17 00:00:00 2001 From: Heinz Wiesinger Date: Wed, 30 Mar 2016 11:43:04 +0200 Subject: [PATCH] Update service handling to use service state. --- filebeat/map.jinja | 4 ++-- filebeat/service.sls | 25 +++++++------------------ 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/filebeat/map.jinja b/filebeat/map.jinja index 53106d4..9098de2 100644 --- a/filebeat/map.jinja +++ b/filebeat/map.jinja @@ -13,12 +13,12 @@ 'RedHat': { 'config_path': '/etc/filebeat/filebeat.yml', 'config_source': 'salt://filebeat/files/filebeat.jinja', - 'runlevels_install': True, + 'runlevels_install': False, }, 'CentOS': { 'config_path': '/etc/filebeat/filebeat.yml', 'config_source': 'salt://filebeat/files/filebeat.jinja', - 'runlevels_install': True, + 'runlevels_install': False, }, 'Suse': { 'config_path': '/etc/filebeat/filebeat.yml', diff --git a/filebeat/service.sls b/filebeat/service.sls index 592726d..daaa86a 100644 --- a/filebeat/service.sls +++ b/filebeat/service.sls @@ -1,22 +1,11 @@ -# 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 +include: + - filebeat.install 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 + - watch: + - pkg: filebeat - require: - pkg: filebeat - - cmd: filebeat.sshkeygen - - cmd: filebeat.pubkeytoauth