ansible.builtin.win_get_url (v2.3.3.0-1) — module

Fetches a file from a given URL

| "added in version" 1.7 of ansible.builtin"

Authors: Paul Durivage (@angstwad), Takeshi Kuramochi (tksarah)

stableinterface | supported by core

Install Ansible via pip

Install with pip install ansible==2.3.3.0.post1

Description

Fetches a file from a URL and saves to locally

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Download earthrise.jpg to specified path
  win_get_url:
    url: http://www.example.com/earthrise.jpg
    dest: C:\Users\RandomUser\earthrise.jpg
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Download earthrise.jpg to specified path only if modified
  win_get_url:
    url: http://www.example.com/earthrise.jpg
    dest: C:\Users\RandomUser\earthrise.jpg
    force: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Download earthrise.jpg to specified path through a proxy server.
  win_get_url:
    url: http://www.example.com/earthrise.jpg
    dest: C:\Users\RandomUser\earthrise.jpg
    proxy_url: http://10.0.0.1:8080
    proxy_username: username
    proxy_password: password

Inputs

    
url:
    default: null
    description:
    - The full URL of a file to download
    required: true

dest:
    default: null
    description:
    - The absolute path of the location to save the file at the URL. Be sure to include
      a filename and extension as appropriate.
    required: true

force:
    choices:
    - 'yes'
    - 'no'
    default: true
    description:
    - If C(yes), will always download the file. If C(no), will only download the file
      if it does not exist or the remote file has been modified more recently than the
      local file. This works by sending an http HEAD request to retrieve last modified
      time of the requested resource, so for this to work, the remote web server must
      support HEAD requests.
    required: false
    version_added: '2.0'
    version_added_collection: ansible.builtin

password:
    default: null
    description:
    - Basic authentication password
    required: false

username:
    default: null
    description:
    - Basic authentication username
    required: false

proxy_url:
    description:
    - The full URL of the proxy server to download through.
    required: false
    version_added: '2.0'
    version_added_collection: ansible.builtin

proxy_password:
    description:
    - Proxy authentication password
    required: false
    version_added: '2.0'
    version_added_collection: ansible.builtin

proxy_username:
    description:
    - Proxy authentication username
    required: false
    version_added: '2.0'
    version_added_collection: ansible.builtin

skip_certificate_validation:
    default: false
    description:
    - Skip SSL certificate validation if true
    required: false

Outputs

dest:
  description: destination file/path
  returned: always
  sample: C:\Users\RandomUser\earthrise.jpg
  type: string
url:
  description: requested url
  returned: always
  sample: http://www.example.com/earthrise.jpg
  type: string