Youssef CH
Youssef CH

Reputation: 741

set specific name to file downloaded with get_url in ansible

I've this task in my playbook

- name: get file
  get_url:
    url: "{{ file_url }}"
    dest: .
  environment:
    https_proxy: "{{ proxy }}"

can i download this file with a other specific name ?

Upvotes: 0

Views: 1569

Answers (1)

erik258
erik258

Reputation: 16304

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/get_url_module.html#parameter-dest

You can set dest to the desired filename. Since you have dest set to a directory, the following applies:

If dest is a directory, either the server provided filename or, if none provided, the base name of the URL on the remote server will be used. If a directory, force has no effect.

Change it to a file path and you can control the name of the file.

Upvotes: 1

Related Questions