Caching get_url tasks

509 views
Skip to first unread message

Warren Seine

unread,
Feb 18, 2015, 4:02:00 AM2/18/15
to ansible...@googlegroups.com
Hi,

For performance (faster first deployment), safety (in case the third party goes down), and bad connectivity (no internet) reasons, I'd like to cache downloads made with get_url.

I know this can be done manually, but I wonder if there's a module to do it. Would a cache=yes property make sense in the get_url module?

Regards,
Warren.

J Hawkesworth

unread,
Feb 18, 2015, 1:46:51 PM2/18/15
to ansible...@googlegroups.com
Are you running get_url as a local action?  (on the ansible master rather than on your managed machines)?

I'd be tempted to try using something like varnish myself.

Jon

Warren Seine

unread,
Feb 24, 2015, 5:55:44 AM2/24/15
to ansible...@googlegroups.com
Non, I'm not use a local action. That would involve sending the data back to the managed machines at some point, basically the same as downloading the file directly on the managed machine.

Varnish could make sense, though I'm not sure if it's not a bit overkill. I would have thought of a simple cache directory where all downloaded files would automatically go.

Dick Davies

unread,
Feb 24, 2015, 7:27:54 AM2/24/15
to ansible list
I use a pattern like this to only get the tarball when the
'grafana_version' var changes.
Seems to work pretty well (NB: this happens up on the server, no local caching).

- name: download grafana tarball
get_url: url=http://grafanarel.s3.amazonaws.com/grafana-{{grafana_version}}.tar.gz
dest=/root/.grafana-{{grafana_version}}.tar.gz

- name: extract tarball to docroot
unarchive: src=/root/.grafana-{{grafana_version}}.tar.gz dest=/opt/
copy=no creates=/opt/grafana-{{grafana_version}}/build.txt
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c6fcaedd-6b5c-4219-baf7-6011fe63b76d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Warren Seine

unread,
Feb 24, 2015, 11:36:15 AM2/24/15
to ansible...@googlegroups.com, di...@hellooperator.net
Ok, simple and straightforward.
Reply all
Reply to author
Forward
0 new messages