Ansible Playbooks can run PowerShell scripts but not long ones

I have Ansible on CentOS. I have some Windows 2012 Servers that get PowerShell scripts pushed down. Various PowerShell scripts can be ran if they don’t take much time. One PowerShell script runs an installer process. There are 18 things that are installed. As a manual process, the PowerShell script works when kicked off by a local administrator. When an Ansible playbook initiates the script, only one component is installed. From the Ansible server, the playbook run is sucessful. The script does need 20 minutes to run. The ansible_ssh_user that is configured in the inventory file is a local administrator. So I don’t think the permissions of the account could be the root cause.

Is there a way to run a PowerShell script asynchronously? Maybe the problem is not a timeout issue. I run the PowerShell script via the Playbook’s “raw” module. This module does not support the “async” directive. The lack of an error message and the partial success are proving difficult to troubleshoot. What should I do?

Ok, there could be a number of things going on here.
WimRM enforces quotas on things like maximum amount of memory used and other resources, presumably as a security measure.

Another thing that could be going on here is that one or more of the 18 things that are installed require an interactive user. I have seen this even on some installers which are running in a silent mode.

I would suggest breaking up the installer script so into several pieces and using Write-Host to report progress.
Then run your playbook with -v so you can see the progress your script is making.

You could also check the windows event logs for error messages.

Hope this helps,

Jon