AnsiblePilot — Master Ansible Automation
AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.
Popular Topics
About Luca Berton
Luca Berton is an Ansible automation expert, author of "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.
Ansible win_get_url Module: Download Files on Windows Hosts (Guide) — Video Tutorial
How to download files on Windows with Ansible win_get_url module. HTTP/HTTPS downloads, proxy support, checksum validation on Windows. Practical YAML playbook examples.
What You'll Learn
- How to download a file in Windows-like systems with Ansible?
- Ansible download a file in Windows-like systems
- Parameters
- Links
- code
- execution
- idempotency
- before execution
- after execution
- Conclusion
Full Tutorial Content
How to download a file in Windows-like systems with Ansible?
I'm going to show you a live Playbook and some simple Ansible code.
I'm Luca Berton and welcome to today's episode of Ansible Pilot.
Ansible download a file in Windows-like systems
- ansible.windows.win_get_url
- Downloads file from HTTP, HTTPS, or FTP to node
Let's talk about the Ansible module `win_get_url`.
The full name is `ansible.windows.win_get_url`, which means that is part of the collection of modules of Ansible to interact with Windows nodes.
It downloads files from HTTP, HTTPS, or FTP to node
For Linux targets, use the `ansible.builtin.get_url` Ansible module instead.
Parameters
- `url` string - URL
- `dest` string - path
- `force` string - no/yes
- `checksum_algorithm`, `checksum`, `checksum_url` string - checksum_algorithm, checksum, checksum_url
- `force_basic_auth`/`url_username`/`url_password`/`use_gssapi` - HTTP basic auth/GSSAPI-Kerberos
- `headers` dictionary - custom HTTP headers
- `http_agent` string - "`ansible-httpget`"
- `proxy_url`, `proxy_username`, `proxy_password`, `proxy_use_default_credential` - proxy
The parameters of the `win_get_url` module.
The two required parameters are `url` and `dest`.
The `url` parameter specifies the URL of the resource you're going to download.
The `dest` parameter specifies the filesystem path where the resource is going to be saved on the target node.
Let's deep dive into the "force" parameter.
If "dest" is a file, Ansible is going to download every time the file. If "dest" is a directory the default behavior is not to replace a file, until you toggle to `yes` the force parameter.
The parameter "checksum" is very useful to validate the consistency of the downloaded file.
You could specify the algorithm under `checksum_algorithm`, default SHA1, and directly the checksum or the checksum URL `checksum_url`.
Another interesting parameter is "headers" which allows you to specify some custom HTTP headers.
Ansible presents himself as "ansible-httpget" in the web server logs, but you cust customize it in the "http_agent" parameter.
There are also additional parameters for the X509 authentication client certificate (.pfx).
Enterprise users could also specify the `proxy` settings parameters.
Links
- [win_get_url module](https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_get_url_module.html)
## Playbook
How to download a file in Windows-like systems with Ansible Playbook.
code
```yaml
---
- name: win_get_url module Playbook
hosts: all
become: false
vars:
myurl: "https://releases.ansible.com/ansible/ansible-2.9.25.tar.gz"
mycrc: "https://releases.ansible.com/ansible/ansible-2.9.25.tar.gz.sha"
mycrc_algorithm: "sha256"
mydest: 'C:\Users\vagrant\Desktop\ansible-2.9.25.tar.gz'
tasks:
- name: download file
ansible.windows.win_get_url:
url: "{{ myurl }}"
dest: "{{ mydest }}"
checksum_algorithm: "{{ mycrc_algorithm }}"
checksum_url: "{{ mycrc }
About This Tutorial
- Author: Luca Berton
- Difficulty: Beginner
- Read time: 3 min
- Category: troubleshooting
Read the full written article: Ansible win_get_url Module: Download Files on Windows Hosts (Guide)
Related Video Tutorials
- Ansible get_url Module: Download Files from URLs (ansible.builtin.get_url Guide) — Complete guide to Ansible get_url module (ansible.builtin.get_url). Download files from HTTP, HTTPS, and FTP URLs with checksum verification and authentication.
- Ansible 'Destination Does Not Exist' Error: Fix Path Issues — Fix Ansible destination does not exist error. Resolve missing parent directories, wrong paths, and permission issues for copy, template, and file modules.
- Ansible 'urlopen error' Fix: SSL, Proxy & Network Connection Issues — Fix Ansible urlopen error for SSL certificate failures, proxy issues, DNS resolution, and network timeouts. Troubleshoot uri, get_url, and pip module connection errors.
- Add Windows Registry on Windows-like systems - Ansible module win_regedit — Learn how to use Ansible win_regedit module to add, change, or remove Windows registry key-values efficiently and accurately with simple Ansible code examples.
- Master Ansible Automation Platform: Simplify IT Management — Unlock the power of Ansible Automation Platform to automate IT tasks effortlessly. Learn its core features with a lighthearted guide that makes automation fun.
- Ansible for Windows: Complete Guide to Windows Automation (2026) — Learn how to automate Windows systems using Ansible. Explore modules, tasks, and best practices to enhance your automation workflows and reduce errors.