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