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