Hi Team,
I am using win shell module to execute some command in windows machine and it executes properly while its used without any retries and delay.
There is one set of code which I wanted to run at least 3 times on a time interval hence I am using retries and delay.
How ever While the delay is 1 minute or less it works properly when the delay is 5 minutes I am getting Winrm transport error 400. The first try of that code executes properly and shows the result and it gives the error on the second try. Below is the error for the same.
{
“msg”: “Unexpected failure during module execution.”,
“exception”: “Traceback (most recent call last):\n File "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/winrm/protocol.py", line 239, in send_message\n root = ET.fromstring(ex.response_text)\n File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 1315, in XML\n return parser.close()\n File "", line None\nxml.etree.ElementTree.ParseError: no element found: line 1, column 0\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/usr/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 145, in run\n res = self._execute()\n File "/usr/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 664, in _execute\n result = self._handler.run(task_vars=variables)\n File "/usr/lib/python3.6/site-packages/ansible/plugins/action/normal.py", line 46, in run\n result = merge_hash(result, self._execute_module(task_vars=task_vars, wrap_async=wrap_async))\n File "/usr/lib/python3.6/site-packages/ansible/plugins/action/init.py", line 917, in _execute_module\n res = self._low_level_execute_command(cmd, sudoable=sudoable, in_data=in_data)\n File "/usr/lib/python3.6/site-packages/ansible/plugins/action/init.py", line 1062, in _low_level_execute_command\n rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)\n File "/usr/lib/python3.6/site-packages/ansible/plugins/connection/winrm.py", line 535, in exec_command\n result = self._winrm_exec(cmd_parts[0], cmd_parts[1:], from_exec=True, stdin_iterator=stdin_iterator)\n File "/usr/lib/python3.6/site-packages/ansible/plugins/connection/winrm.py", line 447, in _winrm_exec\n command_id = self.protocol.run_command(self.shell_id, to_bytes(command), map(to_bytes, args), console_mode_stdin=(stdin_iterator is None))\n File "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/winrm/protocol.py", line 341, in run_command\n res = self.send_message(xmltodict.unparse(req))\n File "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/winrm/protocol.py", line 242, in send_message\n raise ex\n File "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/winrm/protocol.py", line 234, in send_message\n resp = self.transport.send_message(message)\n File "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/winrm/transport.py", line 256, in send_message\n response = self._send_message_request(prepared_request, message)\n File "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/winrm/transport.py", line 273, in _send_message_request\n raise WinRMTransportError(‘http’, ex.response.status_code, response_text)\nwinrm.exceptions.WinRMTransportError: Bad HTTP response returned from server. Code 400\n”,
“stdout”: “”,
“_ansible_no_log”: false
}
Regards
Monohar Behera