Thank you very much for your inputs. I have modified my playbook as below
[test@ansible ~]$ ansible-playbook ServerUptime.yml
Enter VM Hostname or IP Address: test
Enter VM Login Username: test
Enter VM Login Password:
PLAY [Get server uptime] *******************************************************************************************************************************************
TASK [Gathering Facts] *********************************************************************************************************************************************
fatal: [RHELTest01]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).", "unreachable": true}
fatal: [WinTest01]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Nutanix Controller VM\nPermission denied (publickey,password).", "unreachable": true}
PLAY RECAP *********************************************************************************************************************************************************
WinTest01 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
RHELTest01 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
Still my requirement is not fulfilled. It is trying to connect with SSH for Windows machines also.I am looking for a playbook which will take user input and validate the OS to display uptime of the server(VM). Any sort of help is greatly appreciated.