- name: check rdp on windows
win_shell: 'mstsc /v:<windows hostname or IP>'
args:
executable: cmd
register: result
- debug:
var: result
Play 2:
- name: execute bat file
win_command: C:\devops\demo.bat
when i execute any above play it just hangs at below output
Output:
TASK [check rdp on windows] ***********************************************************************************************************************************
task path: /home/vagrant/ansible/server_control.yml:13
Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_shell.ps1
<windows hostname or IP> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO <windows hostname or IP>
checking if winrm_host <windows hostname or IP> is an IPv6 address
<windows hostname or IP> WINRM CONNECT: transport=ssl endpoint=https://<windows hostname or IP>:5986/wsman
<windows hostname or IP> WINRM OPEN SHELL: F40E1253-9543-4A6D-A791-D747BDC7B7D6
EXEC (via pipeline wrapper)
<windows hostname or IP> WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-'] (It just hang here)