I currently using windows 11 machine that have enabled WSL 2.
In WSL i have installed Ansible.
My question is i want to using Ansible in my Windows 11 WSL to install notepad++.
Here is my playbook file:
---
- name: Install Notepad++
hosts: localhost
vars:
ansible_user: <win_user>
ansible_password: <win_password>
ansible_port: 5985
ansible_connection: winrm
ansible_winrm_transport: basic
tasks:
- name: Install Notepad++
win_chocolatey:
name: notepadplusplus
state: present
i also have configured Winrm on my local windows
- Enable WinRM Enable-PSRemoting.
- Enable Basic Auth Set-Item -Path WSMan:localhostServiceAuthBasic -Value $true
- Enable Unencrypted connectionSet-Item -Path WSMan:localhostServiceAllowUnencrypted -Value $true
i have also enable my firewall rule for my ansible in wsl to connectt to local windows if that is necessary
but i still getting this errors:
fatal: [localhost]: UNREACHABLE! => {
"changed": false,
"msg": "basic: HTTPConnectionPool(host='localhost', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f072185bac0>: Failed to establish a new connection: [Errno 111] Connection refused'))",
"unreachable": true
}
i have tried to run this script on Ansible doc in my local window to enable HTTPS listener but it still won’t work
BK Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.