Hi Levi, It looks like you need to use the "force" parameter, which is documented as follows:
If yes and dest is not a directory, will download the file every time and replace the file if the contents change. If no, the file will only be downloaded if the destination does not exist. Generally should be yesonly for small local files. Prior to 0.6, this module behaved as if yes was the default. (added in Ansible 0.7) (We can really remove all the special notes about 0.6 and 0.7, as that's some very old stuff and everyone has upgraded at this point) Also, usual disclaimer about get_url: If you have more than one server, a good tip can be to use a local step in a preceeding play to download a file and then the copy module to move it out. This prevents using your server farm to unintentionally DDOS a particular website or service. 500 or 1000 machines downloading a tarball would be rather abusive, especially if using force=yes or deploying them all at the same time. On Fri, Aug 29, 2014 at 8:12 AM, Levi Notik <[email protected]> wrote: > I'm trying to use get_url to download a file to a group of hosts. My play > looks like this: > > --- > - hosts: webservers > remote_user: ec2-user > tasks: > - name: download jar > get_url: > url: https://s3-us-west-2.amazonaws.com/bucket/some.jar > dest: /home/ec2-user/management/jars/some.jar > notify: restart_service > - name: start_service > service: name=gw-management state=started > sudo: yes > handlers: > - name: restart_service > service: name=gw-management state=restarted > sudo: yes > > The file does not seem to be downloaded if it already exists in the dest > directory. If I delete the file first, everything works as expected. The > docs for get_url are slightly confusing and I'm not sure how dest being a > directory affects things. I've also tried using force. > > Do I simply need to set the destination to /home/ec2-user/management/jars > without the file name and then, as the docs state, "If dest is a > directory, the file will always be downloaded (regardless of the force > option), but replaced only if the contents changed."? Also, how does > ansible determine contents have changed, is it hashing the contents? > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/8eb9da33-a72f-4638-9c6d-ab01549b7fc7%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/8eb9da33-a72f-4638-9c6d-ab01549b7fc7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyaSe-9OUyN9spUQ9k8GDaB620-RggwWrX6pX1K6qE%2Bmg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
