ansible 2.3> while check on windows hosts, error: Thread failed to start

Viewed 1418

I am connecting to windows host via ansible. But I am getting from win_shell an error.

   [as_user@tt ansible-winconnect]$ ansible-playbook -i WIN win_conn.yml -t echo_test --ask-pass -vvvv
    fatal: [x.x.x.x]: FAILED! => {
        "changed": true,
        "cmd": "echo %HOMEDIR% > print.txt",
        "delta": "0:00:00.287028",
        "end": "2017-05-25 11:38:05.603907",
        "failed": true,
        "rc": 1,
        "start": "2017-05-25 11:38:05.316878",
        "stderr": "Thread failed to start.\r\n",
        "stderr_lines": [
            "Thread failed to start."
        ],
        "stdout": "",
        "stdout_lines": []
    }

    [as_user@tt ansible-winconnect]$ cat win-conn/tasks/main.yml
    ---
    - name: Print Home Dir in a file
      win_shell: echo %HOMEDIR% > print.txt
      tags: echo_test
2 Answers

Assuming you have powershell 3+ and you followed the Ansible docs you very well maybe be running into an out of memory issue. According to Microsoft

The issue occurs because the Windows Remote Management (WinRM) service does not use the customized value of the MaxMemoryPerShellMB quota. Instead, the WinRM service uses the default value, which is 150 MB.

The shell created by WinRM might not have enough memory in order to run the powershell that Ansible is trying to run via WinRM.

Try using the following hotfix from Microsoft https://support.microsoft.com/en-us/help/2842230/out-of-memory-error-on-a-computer-that-has-a-customized-maxmemorypersh

Related