For some time I cannot successfully execute ansible playbook on a Windows host with OpenSSH on it. The playbook is very simple:
---
- name: test play
hosts: all
gather_facts: no
tasks:
- name: check if is working
debug: msg='Start execution'
- name: check file
win_stat:
path: C:\nonexistingfile
register: out
- debug: var=out
The inventory:
[group1]
192.168.100.6 ansible_user=Administrator ansible_password=admin1234 ansible_shell_type=cmd
The execution result:
ansible-playbook test.yml -i inv/
PLAY [test play] ************************************************************************************************************************************************************************************************
TASK [check if is working] **************************************************************************************************************************************************************************************
Thursday 18 November 2021 13:04:08 +0200 (0:00:00.106) 0:00:00.106 *****
ok: [192.168.100.6] => {
"msg": "Start execution"
}
TASK [check file] ***********************************************************************************************************************************************************************************************
Thursday 18 November 2021 13:04:08 +0200 (0:00:00.063) 0:00:00.169 *****
fatal: [192.168.100.6]: FAILED! => {"changed": false, "module_stderr": "An error occurred while creating the pipeline.\r\n + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException\r\n + FullyQualifiedErrorId : RuntimeException\r\n ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
PLAY RECAP ******************************************************************************************************************************************************************************************************
192.168.100.6 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Thursday 18 November 2021 13:04:18 +0200 (0:00:10.322) 0:00:10.492 *****
===============================================================================
After hours of investigation I got that the problem is on the remote host side and is related to the Powershell. Powershell version:
> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 19041 1237
On an another host with another powershell version it is working. The powershell version on that host is:
PS C:\Program Files\OpenSSH> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 14393 693
Maybe someone also got this error and found a workaround?