Summary
When running a simple playbook that uses the ansible.windows.* module(i’ve tested some ansible.windows, not all) it always fails on runtime, I’m using WSL1 on Windows 10, so I imagine it is because it is recognizing localhost as the wsl virtual machine and not my windows machine, I’m unsure if this is the case since im new to Ansible, but I have researched this quite a bit and didn’t find a concrete awnser.
My inventory
[localhost]
127.0.0.1 ansible_connection=local
Can upgrading the WSL version to WSL2 fix this issue?
Ansible Version
$ ansible --version
ansible [core 2.14.5]
OS / Environment
WSL1, Windows 10
Steps to Reproduce
- name: test
hosts: localhost
gather_facts: false
tasks:
- name: Run basic PowerShell script
ansible.windows.win_powershell:
script: |
echo “Hello World”
Expected Results
Hello World
Actual Results
fatal: [127.0.0.1]: FAILED! => {
“changed”: false,
“module_stderr”: “/bin/sh: 1: powershell: not found\n”,
“module_stdout”: “”,
“msg”: “The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error”,
“rc”: 127
}