• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

Ansible error "PORT STATE SERVICE 5986/tcp closed wsmans"

WSL is Linux on Windows machine, you can enable this feature Linux Subsystem for Windows.
In other words you can run Linux terminal on Windows Machine.
It belongs in the "Off-topic" section where it is now because because WSL isn't native Linux, also looks like you are using "winrm" as connection from from Ansible from within WSL, that means you are connecting to a Windows client since when connecting to a Linux client you use ssh. Therefore the most logical place for this topic is the "Off-topic" section because WSL isn't native Linux and it doesn't function the same, as well as that all the systems you are actually using are Windows.

Ok,"Off-topic" - I got it.
But is there anyone who has any clue why I recieve these error message?
-really appreciate your answer

The controller: Windows, version 10 20H4, WSL (Windows subsystem for Linux)
Target machine: Windows server 2019

ansible winserver -m win_ping
[WARNING]: Could not match supplied host pattern, ignoring: winserver
[WARNING]: No hosts matched, nothing to do

Here´s the hosts file:
[servers] [servers:vars] ansible_user="[email protected]" ansible_password=somepassword ansible_connection=winrm ansible_winrm_transport=credssp ansible_winrm_server_cert_validation=ignore

Here´s output from
Ansible --version
ansible [core 2.12.0]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/user1/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /home/user1/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
jinja version = 2.10.1
libyaml = True

winrm get winrm/config/Service
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 1500
EnumerationTimeoutms = 240000
MaxConnections = 300
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = false
Basic = false [Source="GPO"]
Kerberos = true
Negotiate = true
Certificate = false
CredSSP = true [Source="GPO"]
CbtHardeningLevel = Relaxed
HTTP = 5985
HTTPS = 5986
IPv4Filter = * [Source="GPO"]
IPv6Filter = * [Source="GPO"]
EnableCompatibilityHttpListener = false
EnableCompatibilityHttpsListener = false
AllowRemoteAccess = true [Source="GPO"]
Last edited:
Now the ansible winserver -m win_ping command succeded: | SUCCESS => {
"changed": false,
"ping": "pong"

If you have the same problem.
-Check your spelling in the win_ping command

Members online

No members online now.

Latest posts