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

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



CONTROLLER:
Here´s the hosts file:
[servers] 122.106.11.16 [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



TARGET MACHINE
winrm get winrm/config/Service
Service
RootSDDL = O:NSG:BADA;;GA;;;BA)(A;;GR;;;IU)S(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 1500
EnumerationTimeoutms = 240000
MaxConnections = 300
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = false
Auth
Basic = false [Source="GPO"]
Kerberos = true
Negotiate = true
Certificate = false
CredSSP = true [Source="GPO"]
CbtHardeningLevel = Relaxed
DefaultPorts
HTTP = 5985
HTTPS = 5986
IPv4Filter = * [Source="GPO"]
IPv6Filter = * [Source="GPO"]
EnableCompatibilityHttpListener = false
EnableCompatibilityHttpsListener = false
CertificateThumbprint
AllowRemoteAccess = true [Source="GPO"]
 
Last edited:
Now the ansible winserver -m win_ping command succeded:
122.106.11.16 | SUCCESS => {
"changed": false,
"ping": "pong"
}


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

Members online


Latest posts

Top