Ansible URI and GET_URL does not work for downloading

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:

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\"?>\nAccessDeniedAccess 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”, “via”: “1.1 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

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&quot;
    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&quot;
    headers:
      Cookie: "{{ stuff_list.cookies }}"
    dest: /mytest
  
<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

This morning I just found my URL is missing .0 in /Redhat_Enterprise_7.0 part. Now it is working for me too. Thanks!

  • Xinhuan