This is what am getting
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/sha re/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (R ed Hat 4.8.5-36)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/lib/python2.7/sit e-packages/ansible/plugins/callback/init.pyc
META: ran handlers
Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_p ing.ps1
<10.67.104.45> ESTABLISH WINRM CONNECTION FOR USER:username on P ORT 5986 TO 10.67.104.45
<10.67.104.45> WINRM CONNECT: transport=basic endpoint=https://10.67.104.45:5986 /wsman
<10.67.104.45> WINRM CONNECTION ERROR: the specified credentials were rejected b y the server
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py”, l ine 222, in winrm_connect
self.shell_id = protocol.open_shell(codepage=65001) # UTF-8
File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 157, in open_s hell
res = self.send_message(xmltodict.unparse(req))
File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 234, in send_m essage
resp = self.transport.send_message(message)
File “/usr/lib/python2.7/site-packages/winrm/transport.py”, line 256, in send message
response = self._send_message_request(prepared_request, message)
File “/usr/lib/python2.7/site-packages/winrm/transport.py”, line 266, in _send _message_request
raise InvalidCredentialsError(“the specified credentials were rejected by th e server”)
InvalidCredentialsError: the specified credentials were rejected by the server
10.67.104.45 | UNREACHABLE! => {
“changed”: false,
“msg”: “basic: the specified credentials were rejected by the server”,
“unreachable”: true
}
Listener setup:
$selector_set = @{
Address = “*”
Transport = “HTTPS”
}
$value_set = @{
CertificateThumbprint = “EF39ECD8A40F83ACC2BE85D95303EED2EB7DCE5C”
}
New-WSManInstance -ResourceURI “winrm/config/Listener” -SelectorSet $selector_set -ValueSet $value_set
Basic winrm setup :
$url = “https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1”
$file = “$env:temp\ConfigureRemotingForAnsible.ps1”
$username = "username "
$password = “password”
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
$browser = New-Object System.Net.WebClient
$browser.Proxy.Credentials =[System.Net.CredentialCache]::DefaultNetworkCredentials
$browser.DownloadFile($url, $file)
version can be 3.0, 4.0 or 5.1
#&$file -Version 3.0 -Username $username -Password $password -Verbose
#(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
powershell.exe -ExecutionPolicy ByPass -File $file
I just checked the connection with other windows power shell as follows.
PS C:\Users\sindhu.p> winrs -r:https://ipaddress:5986/wsman -u:username -p:password ipconfig
Error :
Winrs error:The server certificate on the destination computer (10.67.104.45:5986) has the following errors:
The SSL certificate is signed by an unknown certificate authority.
The SSL certificate contains a common name (CN) that does not match the hostname.