# Best practices when downloading files in a role.

**URL:** <https://forum.ansible.com/t/best-practices-when-downloading-files-in-a-role/19484>\
**Category:** Ansible Project\
**Created:** [October 12, 2015, 12:10am UTC](https://forum.ansible.com/t/best-practices-when-downloading-files-in-a-role/19484 "2015-10-12T00:10:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Speaks](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@Alex\_Speaks](https://forum.ansible.com/u/Alex_Speaks)\
**Post date:** [October 12, 2015, 12:10am UTC](https://forum.ansible.com/t/best-practices-when-downloading-files-in-a-role/19484/1 "2015-10-12T00:10:56Z")

</div>

I like my roles to be as turnkey as possible. Consequently, I configure them to download the software components they need using a combination of local\_action: get\_url and run\_once=yes.

- name: “download archiva if we don’t already have it in the files directory”  
local\_action: get\_url url={{ archiva\_url }} force=no dest=./roles/archiva/files/archiva.war  
sudo: false  
run\_once: true

I could just as easily download these components to the target machine:

- name: “download archiva if we don’t already have it on the remote machine”  
get\_url: url={{ archiva\_url }} force=no dest=/opt/tomcat/archiva/archiva.war

Or, I could simply tell the user to place the archiva.war file in /roles/archiva/files ahead of time which would be much easier but less snazzy. Downloading them locally means that my local box can act as a distribution point if I’m running my playbook against multiple systems. Downloading remotely seems to be the intended methodology however it means that every box must download the file for itself which could be a lot of bandwidth if we are talking about many target machines.

Which of these methods would you use when writing a role for public consumption? Have I missed something obvious?

Thanks in advance!  
-Alex Speaks
