# Ansible script module could not daemonize filebeat

**URL:** <https://discuss.elastic.co/t/ansible-script-module-could-not-daemonize-filebeat/156003>\
**Category:** Beats\
**Created:** [November 9, 2018, 8:22am UTC](https://discuss.elastic.co/t/ansible-script-module-could-not-daemonize-filebeat/156003 "2018-11-09T08:22:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali\_Sahin](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Ali\_Sahin](https://discuss.elastic.co/u/Ali_Sahin)\
**Post date:** [November 9, 2018, 8:22am UTC](https://discuss.elastic.co/t/ansible-script-module-could-not-daemonize-filebeat/156003/1 "2018-11-09T08:22:01Z")

</div>

Sudo service filebeat start does not work when running script remote with ansible.  
Ansible --version:  
ansible 2.4.1.0  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u'/home/ec2-user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']  
ansible python module location = /usr/local/lib/python2.7/site-packages/ansible  
executable location = /usr/local/bin/ansible  
python version = 2.7.14 (default, May 2 2018, 18:31:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

Filebeat version is current latest version 6.4  
I run the following code from remote,  
unbuffer ansible all -i /tmp/hosts\_-4972515539809608044 --private-key=/tmp/tmpfiledeploytask5639761060323527345wowzee -u ec2-user -m script -a filebeatStart.sh

my script is:

#!/usr/bin/env bash  
sudo service filebeat start  
sleep 100

filebeat start to send logs to elasticsearch. After 100 second passes and ansible close session, all daemonized process also die.

There are some issues in 2016's and they solved the problem caused by daemon stream. However, I still face with same problem when use script module of ansible.

Thank you in advance

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 7, 2018, 10:22am UTC](https://discuss.elastic.co/t/ansible-script-module-could-not-daemonize-filebeat/156003/2 "2018-12-07T10:22:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
