Retrieving a document to a unique name?

4 views
Skip to first unread message

Mike Eggleston

unread,
Mar 2, 2020, 3:41:50 PM3/2/20
to ansible...@googlegroups.com
I will write a program that looks for network devices on its local network and created a report of the findings. That’s easy. Using Ansible to push out the program and execute the program is easy. But how do I pull the report back to a unique name? For example the report is created as /tmp/report. I want to pull that file back to a file named /tmp/report-network.txt. What module do I use to pullback the file? The fetch module?

TIA

Mike

Vladimir Botka

unread,
Mar 2, 2020, 8:07:33 PM3/2/20
to Mike Eggleston, ansible...@googlegroups.com
"fetch" module is a good choice to pull the report back to a unique name. The
unique name will be automatically created by the module. Quoting:

"...default behavior of appending hostname/path/to/file to the
destination ... retrieving files that are uniquely named per host."

This behaviour can be switched off by "flat: true".
https://docs.ansible.com/ansible/latest/modules/fetch_module.html#parameters

HTH,

-vlado

Mike Eggleston

unread,
Mar 6, 2020, 2:04:02 PM3/6/20
to Vladimir Botka, ansible...@googlegroups.com
Thank you. That’s what I needed.

Mike

> On Mar 2, 2020, at 19:07, Vladimir Botka <vbo...@gmail.com> wrote:
>
> On Mon, 2 Mar 2020 14:41:28 -0600
Reply all
Reply to author
Forward
0 new messages