# Ansible URI and GET\_URL does not work for downloading

**URL:** <https://forum.ansible.com/t/ansible-uri-and-get-url-does-not-work-for-downloading/32591>\
**Category:** Ansible Project\
**Created:** [April 2, 2020, 9:21pm UTC](https://forum.ansible.com/t/ansible-uri-and-get-url-does-not-work-for-downloading/32591 "2020-04-02T21:21:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xinhuan\_Zheng](https://avatars.discourse-cdn.com/v4/letter/x/a88e57/32.png) [@Xinhuan\_Zheng](https://forum.ansible.com/u/Xinhuan_Zheng)\
**Post date:** [April 2, 2020, 9:21pm UTC](https://forum.ansible.com/t/ansible-uri-and-get-url-does-not-work-for-downloading/32591/1 "2020-04-02T21:21:35Z")

</div>

Hello,

I need to use Ansible URI and GET\_URL to download a piece of software called amanda backup server. I’m getting trouble with downloading. This is my playbook:

- name: Create cookie for later request  
uri:  
url: “[https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat\_Enterprise\_7.0/amanda-backup\_server-3.5.1-1.rhel7.x86\_64.rpm](https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat_Enterprise_7.0/amanda-backup_server-3.5.1-1.rhel7.x86_64.rpm)”  
follow\_redirects: all  
register: stuff\_list

- name: Debug  
debug:  
msg: “{{ stuff\_list }}”

- name: Download amanda software  
get\_url:  
url: “[https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat\_Enterprise\_7.0/amanda-backup\_server-3.5.1-1.rhel7.x86\_64.rpm](https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat_Enterprise_7.0/amanda-backup_server-3.5.1-1.rhel7.x86_64.rpm)”  
headers:  
Cookie: “{{ stuff\_list.cookies }}”  
dest: /mytest

I’m getting below errors:

TASK [amanda : Create cookie for later request] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [myserver]: FAILED! =\> {“changed”: false, “connection”: “close”, “content”: “\<?xml version=\"1.0\" encoding=\"UTF-8\"?\>\n`AccessDenied`Access Denied13AAEE01DDC4B1B6nc/VbplLWPwS8Z43nTSicEBc+0I7cZcdnSC7XZHUp9zV1bV6ivJhN56nqtTGNOPG95iV5yKnO1Q=”, “content\_type”: “application/xml”, “date”: “Thu, 02 Apr 2020 21:18:00 GMT”, “elapsed”: 0, “msg”: “Status code was 403 and not [200]: HTTP Error 403: Forbidden”, “redirected”: false, “server”: “AmazonS3”, “status”: 403, “transfer\_encoding”: “chunked”, “url”: “[https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat\_Enterprise\_7/amanda-backup\_server-3.5.1-1.rhel7.x86\_64.rpm](https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat_Enterprise_7/amanda-backup_server-3.5.1-1.rhel7.x86_64.rpm)”, “via”: “1.1 [b7d10369ae737ec35cf8d7faced56ef0.cloudfront.net](http://b7d10369ae737ec35cf8d7faced56ef0.cloudfront.net) (CloudFront)”, “x\_amz\_cf\_id”: “iOQFt0a3nEBiQp23AZEtTJVDF1WYWqCHSqxPQJjihj02ccKxvlhUNQ==”, “x\_amz\_cf\_pop”: “EWR53-C2”, “x\_cache”: “Error from cloudfront”}

Has anyone used URI and GET\_URL to successfully download any software from CloudFront?

Thanks,

- Xinhuan

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 2, 2020, 9:55pm UTC](https://forum.ansible.com/t/ansible-uri-and-get-url-does-not-work-for-downloading/32591/2 "2020-04-02T21:55:54Z")

</div>

> Hello,
> 
> I need to use Ansible URI and GET\_URL to download a piece of software  
> called amanda backup server. I'm getting trouble with downloading. This is  
> my playbook:
> 
> - name: Create cookie for later request  
> &nbsp;&nbsp;uri:  
> &nbsp;&nbsp;&nbsp;&nbsp;url:  
> "[https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat\_Enterprise\_7.0/amanda-backup\_server-3.5.1-1.rhel7.x86\_64.rpm&quot](https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat_Enterprise_7.0/amanda-backup_server-3.5.1-1.rhel7.x86_64.rpm&quot);  
> &nbsp;&nbsp;&nbsp;&nbsp;follow\_redirects: all  
> &nbsp;&nbsp;register: stuff\_list
> 
> - name: Debug  
> &nbsp;&nbsp;debug:  
> &nbsp;&nbsp;&nbsp;&nbsp;msg: "{{ stuff\_list }}"
> 
> - name: Download amanda software  
> &nbsp;&nbsp;get\_url:  
> &nbsp;&nbsp;&nbsp;&nbsp;url:  
> "[https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat\_Enterprise\_7.0/amanda-backup\_server-3.5.1-1.rhel7.x86\_64.rpm&quot](https://cdn.zmanda.com/downloads/community/Amanda/3.5.1/Redhat_Enterprise_7.0/amanda-backup_server-3.5.1-1.rhel7.x86_64.rpm&quot);  
> &nbsp;&nbsp;&nbsp;&nbsp;headers:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cookie: "{{ stuff\_list.cookies }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;dest: /mytest  
> &nbsp;&nbsp;  
> \<snip /\>

> Has anyone used URI and GET\_URL to successfully download any software from  
> CloudFront?

get\_url without the headers work for me.

$ cat test.yml

---

<div class="post-metadata">

**Author:** ![Xinhuan\_Zheng](https://avatars.discourse-cdn.com/v4/letter/x/a88e57/32.png) [@Xinhuan\_Zheng](https://forum.ansible.com/u/Xinhuan_Zheng)\
**Post date:** [April 3, 2020, 11:57am UTC](https://forum.ansible.com/t/ansible-uri-and-get-url-does-not-work-for-downloading/32591/3 "2020-04-03T11:57:16Z")

</div>

This morning I just found my URL is missing .0 in [/Redhat\_Enterprise\_7.0](https://www.google.com/url?q=https%3A%2F%2Fcdn.zmanda.com%2Fdownloads%2Fcommunity%2FAmanda%2F3.5.1%2FRedhat_Enterprise_7.0%2Famanda-backup_server-3.5.1-1.rhel7.x86_64.rpm&sa=D&sntz=1&usg=AFQjCNEjZAEdUVdeYQJfNAkXZpvhNF_lew) part. Now it is working for me too. Thanks!

- Xinhuan
