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