Documentation

win_get_url - Fetches a file from a given URL

New in version 1.7.

Synopsis

Fetches a file from a URL and saves to locally

Options

parameter required default choices comments
dest
yes
    The absolute path of the location to save the file at the URL. Be sure to include a filename and extension as appropriate.
    force
    (added in 2.0)
    no True
    • yes
    • no
    If yes, will always download the file. If no, will only download the file if it does not exist or the remote file has been modified more recently than the local file.
    password
    no
      Basic authentication password
      proxy_password
      (added in 2.0)
      no
        Proxy authentication password
        proxy_url
        (added in 2.0)
        no
          The full URL of the proxy server to download through.
          proxy_username
          (added in 2.0)
          no
            Proxy authentication username
            skip_certificate_validation
            no
              Skip SSL certificate validation if true
              url
              yes
                The full URL of a file to download
                username
                no
                  Basic authentication username

                  Examples

                  # Downloading a JPEG and saving it to a file with the ansible command.
                  # Note the "dest" is quoted rather instead of escaping the backslashes
                  $ ansible -i hosts -c winrm -m win_get_url -a "url=http://www.example.com/earthrise.jpg dest='C:\Users\Administrator\earthrise.jpg'" all
                  
                  # Playbook example
                  - name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg'
                    win_get_url:
                      url: 'http://www.example.com/earthrise.jpg'
                      dest: 'C:\Users\RandomUser\earthrise.jpg'
                  
                  - name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg' only if modified
                    win_get_url:
                      url: 'http://www.example.com/earthrise.jpg'
                      dest: 'C:\Users\RandomUser\earthrise.jpg'
                      force: no
                  
                  - name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg' 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'
                  

                  This is a Core Module

                  For more information on what this means please read Core Modules

                  For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.