AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 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 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", 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 troubleshooting - Module Failure on Windows-target — Video Tutorial

Discover how to troubleshoot Module Failure on Windows-target in Ansible, focusing on resolving execution errors effectively.

Watch Video

Watch "Ansible troubleshooting - Module Failure on Windows-target" on YouTube

What You'll Learn

Full Tutorial Content

Introduction Today we’re going to talk about Ansible troubleshooting, specifically about the Module Failure on Windows-target. I’m Luca Berton and welcome to today’s episode of Ansible Pilot. Root Cause The error occurs when you use a **Linux/Unix module** (`ansible.builtin.get_url`) on a **Windows target**. Ansible tries to execute Python code on the Windows host, but Windows runs PowerShell — not Python. The error message shows PowerShell trying to parse Python syntax and failing. **The fix:** Use the Windows-specific module `ansible.windows.win_get_url` instead of `ansible.builtin.get_url`. Common Module Mapping: Linux vs Windows | Linux Module | Windows Module | Purpose | |---|---|---| | `ansible.builtin.get_url` | `ansible.windows.win_get_url` | Download files | | `ansible.builtin.copy` | `ansible.windows.win_copy` | Copy files to remote | | `ansible.builtin.file` | `ansible.windows.win_file` | Manage files/directories | | `ansible.builtin.template` | `ansible.windows.win_template` | Deploy templates | | `ansible.builtin.service` | `ansible.windows.win_service` | Manage services | | `ansible.builtin.user` | `ansible.windows.win_user` | Manage users | | `ansible.builtin.package` | `chocolatey.chocolatey.win_chocolatey` | Install packages | | `ansible.builtin.command` | `ansible.windows.win_command` | Run commands | | `ansible.builtin.shell` | `ansible.windows.win_shell` | Run shell commands | How to Identify This Error Look for these signs in the error output: 1. **"No python interpreters found"** — Ansible is looking for Python on a Windows host 2. **PowerShell parse errors** — `"An expression was expected after"`, `ParseException` 3. **"MODULE FAILURE"** with `rc: 1` 4. Python syntax in `module_stderr` — `def`, `import`, `sys.version_info` Playbook How to troubleshoot the Module Failure on Windows-target. error 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" mydest: 'C:\Users\vagrant\Desktop\ansible-2.9.25.tar.gz' tasks: - name: download file ansible.builtin.get_url: url: "{{ myurl }}" dest: "{{ mydest }}" ``` error execution ```bash ansible-pilot $ ansible-playbook -i virtualmachines/win/inventory troubleshooting/get_url_error.yml PLAY [win_get_url module Playbook] ******************************************************************** TASK [Gathering Facts] **************************************************************************** ok: [WindowsServer] TASK [download file] ****************************************************************************** [WARNING]: No python interpreters found for host WindowsServer (tried ['python3.10', 'python3.9', 'python3.8', 'python3.7', 'python3.6', 'python3.5', '/usr/bin/python3', '/usr/libexec/platform- python', 'python2.7', 'python2.6', '/usr/bin/python', 'python']) fatal: [WindowsServer]: FAILED! => {"ansible_facts": {"discovered_interpreter_

About This Tutorial

Read the full written article: Ansible troubleshooting - Module Failure on Windows-target

Topics Covered

Related Video Tutorials