I'm trying to execute powershell script via ansible, however playbook is successfully running but its incomplete. same script if I run directely on windows server its perfectly working, its failing whenever i ran through ansible playbook.
Please find below details of playbook, inventory, ansible debug, error.
Kindly review my request and suggest me a solution for this problem.
$ cat Citrix_CC_install.yml
---
- hosts: win
become_method: runas
gather_facts: false
tasks:
- name: run citrix build script and redirect same.
win_shell: '.\Invoke_CitricCCPrerequisites.ps1'
args:
chdir: C:\Temp\Citrix\PSScripts
register: Invoke_PreCC_out
- debug: var=Invoke_PreCC_out.stdout_lines
- name: Use the variable in conditional statement
win_reboot:
post_reboot_delay: 180
when: "'ECode=0' in Invoke_PreCC_out.stdout_lines"
- name: configure the settings
win_shell: '.\Invoke_CloudConnectorInstall.ps1'
become: yes
become_user: System
args:
chdir: C:\Temp\Citrix\PSScripts
register: Invoke_CC_Install_out
- debug: var=Invoke_CC_Install_out.stdout_lines
--------------------------------------------------------------------------
###Inventory File###
$ cat inventory
[win]
[win:vars]
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
ansible_winrm_transport=ntlm
ansible_winrm_scheme=https
ansible_port=5986
ansible_user=username
ansible_password='********'
ansible_winrm_operation_timeout_sec=120
ansible_winrm_read_timeout_sec=240
[$
TASK
[debug]
*****************************************************************************************************************
ok:
[hostname] => {
"Invoke_CC_Install_out.stdout_lines": [
"@{CloudCommonParams=System.Object[]; CloudConnServers=System.Object[];
Certs=System.Object[]}",
"** Installing... C:\\Temp\\Citrix\\Assets\\cwcconnector.exe with
arguments /q
/ParametersFilePath:C:\\Temp\\Citrix\\Configs\\CloudConfig.json.",
"1603",
"Connector Installation Result Code: 1603",
"The cloud connector installation failed, exiting the process."
]
}
---------------------------------------------------
[0530:11FC][2021-07-12T15:01:08]e000: Encountered an unexpected exception while determining connector TimeOutOfSync status with message: One or more errors occurred.
[0530:1280][2021-07-12T15:01:29]e000: Encountered an unexpected exception while determining whether the current connector is a supported version. : System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
40.90.246.186:443 at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient.HttpRedirectHandler.<SendAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient.<RawSendAsync>d__59.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Citrix.CloudServices.AgentHub.ApiClient.AgentHubClient.<SendAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Citrix.CloudServices.AgentHub.ApiClient.AgentHubClient.<GetConnectorInstallationVersionStateAsync>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Citrix.CloudServices.SetupTools.Setup.SetupApplication.<IsSupportedVersionAsync>d__44.MoveNext()
[0530:11FC][2021-07-12T15:01:50]e000: Encountered an unexpected exception while validating resource location id. : System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xx.xx.xx.xx:443
at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient.HttpRedirectHandler.<SendAsync>d__2.MoveNext()