Fetch from URL to local machine and then copy to remote

Hi,

I am looking for a way to download a file to the local machine where ansible was started and then copy that file to the remote server. Background: due to security issues we cannot directly download the file from our nexus on the remote server so we need to download it first to the local machine and the use that file in ansible. Currently we start a small shell script before using ansible for this deployment but this is not very nice :wink: Is there something which can be used currently or do we have to write an own module?

Thanks,

Martin

Sounds like you can use the 'get_url' module with 'delegate_to:
127.0.0.1' to download the file locally, then use the 'copy' module to
copy it to the remote host.

I am looking for a way to download a file to the local machine where
ansible was started and then copy that file to the remote server.

action: get_url ...
action: copy ...

        -JP

​That's exactly what we do. Though depending on which url you use to
download from nexus, you might want to choose the uri module to do the
download. ​The latter one allows you to register the exact filename, when
you use Nexus' rest api, which does a redirect to the exact file location.

Serge

thx guys. will try that

i finally used something like that:

  • name: download locally
    local_action: get_url dest

works fine.

Thanks to all