Your privilege escalation logic doesn’t look right. Please read up on https://docs.ansible.com/ansible/latest/user_guide/become.html More specifically don’t issue sudo as part of a command but instead use the ‘become’ logic of ansible.
Also what environment variables does this filebeat command expect? Running things manually in an interactive shell usually exposes a different set of environment vars than the ansible shell/command module. See https://docs.ansible.com/ansible/latest/user_guide/playbooks_environment.html Slightly related, the command uses a relative path so it could mean that it runs a different filebeat than what you’re using in an interactive shell. Dick On Thu, 20 Jun 2019 at 11:41, Prakash Sharma <[email protected]> wrote: > I am too facing this issue. > > When I do manually in the server , works fine , but from ansible ( using > service module , command, shell , and even raw command ) it doesnt start . > > Has anyone seen this , if yes , any clue ? > > > > On Thursday, June 21, 2018 at 3:28:47 AM UTC+8, Daastan Pradhan wrote: >> >> I am running this task in ansible playbook. >> - name: Start filebeat service >> shell: /fisc/uts/bin/sudo filebeat start >> >> This doesnot start the filebeat agent. But I have checked manually >> running that command on the test servers. It works fine. ( I tried >> ‘command’ instead of ‘shell’, it doesnt work either) >> >> The stop command works tho if I replace start with stop. But ‘start’ and >> ‘restart’ doesnt work.Can you please help? > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/d008e341-0ce6-4711-a3c0-0630086618a6%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/d008e341-0ce6-4711-a3c0-0630086618a6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Sent from a mobile device - please excuse the brevity, spelling and punctuation. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwNb-924Jgtq7VQPDkh5i3gWxFb4S%2BTKizMZtDoi3rjYRQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
