Yes, the easiest way would be to just direct it in the shell command.

shell: ./myBinary > /tmp/file

Or if you want Ansible to still see the stdout, do:

shell: ./myBinary | tee /tmp/file

This only deals with stdout. Let me know if you want to capture stderr too. 
(There are equivilent ways of capturing both.)


The alternative is registering the output and saving the content in the 
next step.

- shell: ./myBinary
  register: shellTask

- copy:
    content: shellTask.stdout
    path: /tmp/file

Regards,
Matt

On Wednesday, May 1, 2019 at 2:57:10 AM UTC+10, Rahul Kolan wrote:
>
> In Ansible is there any way i can append the shell script out to in one 
> file.
> basically I have script which does some validation like services status up 
> after the OS upgrade.
> I want to execute the script on remote machine & append the output in 
> remote system somewhere under "/tmp/file".
>  
>
> *Thanks & Regards,*
>
> *Rahul *
>
>
>
>
>
>
>
> *DISCLAIMER: *
> This message including attachments if any intended solely for specific 
> individual and purpose & may contain confidential material AND/OR Private 
> Company Information. If you are not the intended recipient, any disclosure, 
> copying or distribution of this message or any action based on it, is 
> strictly prohibited & protected under relevant law. If you have received 
> this communication in error, please contact the sender or delete this 
> message immediately. Thank you for your kind cooperation. 
>

-- 
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/22fb744c-7d8a-4760-82bd-1685b86aa37c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to