[ HELP ] Ansible Module Error [ Parameter format not correct - >nul\r\n ]

Hi Team,

Good day,

I am trying to deploy the app to the Windows server from redhat. Actually, it was successfully running for several weeks but Since Yesterday morning I am facing this strange issue after running the playbook.So tried with only win_ping module that also not successful

Error:

ansible-playbook 2.9.17 config file = /root/myteam/stephen/Ansible/DeployApp/ansible.cfg configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible-playbook python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] Using /root/Ansible/DeployAppToServer/ansible.cfg as config file SSH password: host_list declined parsing /root/myteam/stephen/Ansible/DeployApp/ehosts as it did not pass its verify_file() method script declined parsing /root/myteam/stephen/Ansible/DeployApp/ehosts as it did not pass its verify_file() method auto declined parsing /root/myteam/stephen/Ansible/DeployApp/ehosts as it did not pass its verify_file() method Parsed /root/myteam/stephen/Ansible/DeployApp/ehosts inventory source with ini plugin Skipping callback ‘actionable’, as we already have a stdout callback. Skipping callback ‘counter_enabled’, as we already have a stdout callback. Skipping callback ‘debug’, as we already have a stdout callback. Skipping callback ‘dense’, as we already have a stdout callback. Skipping callback ‘dense’, as we already have a stdout callback. Skipping callback ‘full_skip’, as we already have a stdout callback. Skipping callback ‘json’, as we already have a stdout callback. Skipping callback ‘minimal’, as we already have a stdout callback. Skipping callback ‘null’, as we already have a stdout callback. Skipping callback ‘oneline’, as we already have a stdout callback. Skipping callback ‘selective’, as we already have a stdout callback. Skipping callback ‘skippy’, as we already have a stdout callback. Skipping callback ‘stderr’, as we already have a stdout callback. Skipping callback ‘unixy’, as we already have a stdout callback. Skipping callback ‘yaml’, as we already have a stdout callback. PLAYBOOK: test.yml ***************************************************************************************************************************************************** 1 plays in test.yml PLAY [Push App to webserver] ************************************************************************************************************************************** META: ran handlers TASK [Ping Server] ***************************************************************************************************************************************************** task path: /root/myteam/stephen/Ansible/DeployApp/test.yml:7 Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_ping.ps1 Pipelining is enabled. <192.168.1.45> ESTABLISH SSH CONNECTION FOR USER: Richard <192.168.1.45> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o ‘User=“Richard”’ -o ConnectTimeout=25 -o ControlPath=/root/.ansible/cp/16376c84cb 192.168.1.45 ‘chcp.com 65001 >nul 2>&1 && PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UABvAHcAZQByAFMAaABlAGwAbAAgAC0ATgBvAFAAcgBvAGYAaQBsAGUAIAAtAE4AbwBuAEkAbgB0AGUAcgBhAGMAdABpAHYAZQAgAC0ARQB4AGUAYwB1AHQAaQBvAG4AUABvAGwAaQBjAHkAIABVAG4AcgBlAHMAdAByAGkAYwB0AGUAZAAgAC0ARQBuAGMAbwBkAGUAZABDAG8AbQBtAGEAbgBkACAASgBnAEIAagBBAEcAZwBBAFkAdwBCAHcAQQBDADQAQQBZAHcAQgB2AEEARwAwAEEASQBBAEEAMgBBAEQAVQBBAE0AQQBBAHcAQQBEAEUAQQBJAEEAQQArAEEAQwBBAEEASgBBAEIAdQBBAEgAVQBBAGIAQQBCAHMAQQBBAG8AQQBKAEEAQgBsAEEASABnAEEAWgBRAEIAagBBAEYAOABBAGQAdwBCAHkAQQBHAEUAQQBjAEEAQgB3AEEARwBVAEEAYwBnAEIAZgBBAEgATQBBAGQAQQBCAHkAQQBDAEEAQQBQAFEAQQBnAEEAQwBRAEEAYQBRAEIAdQBBAEgAQQBBAGQAUQBCADAAQQBDAEEAQQBmAEEAQQBnAEEARQA4AEEAZABRAEIAMABBAEMAMABBAFUAdwBCADAAQQBIAEkAQQBhAFEAQgB1AEEARwBjAEEAQwBnAEEAawBBAEgATQBBAGMAQQBCAHMAQQBHAGsAQQBkAEEAQgBmAEEASABBAEEAWQBRAEIAeQBBAEgAUQBBAGMAdwBBAGcAQQBEADAAQQBJAEEA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ADAAQQBWAGcAQgBoAEEASABJAEEAYQBRAEIAaABBAEcASQBBAGIAQQBCAGwAQQBDAEEAQQBMAFEAQgBPAEEARwBFAEEAYgBRAEIAbABBAEMAQQBBAGEAZwBCAHoAQQBHADgAQQBiAGcAQgBmAEEASABJAEEAWQBRAEIAMwBBAEMAQQBBAEwAUQBCAFcAQQBHAEUAQQBiAEEAQgAxAEEARwBVAEEASQBBAEEAawBBAEgATQBBAGMAQQBCAHMAQQBHAGsAQQBkAEEAQgBmAEEASABBAEEAWQBRAEIAeQBBAEgAUQBBAGMAdwBCAGIAQQBEAEUAQQBYAFEAQQBLAEEAQwBRAEEAWgBRAEIANABBAEcAVQBBAFkAdwBCAGYAQQBIAGMAQQBjAGcAQgBoAEEASABBAEEAYwBBAEIAbABBAEgASQBBAEkAQQBBADkAQQBDAEEAQQBXAHcAQgBUAEEARwBNAEEAYwBnAEIAcABBAEgAQQBBAGQAQQBCAEMAQQBHAHcAQQBiAHcAQgBqAEEARwBzAEEAWABRAEEANgBBAEQAbwBBAFEAdwBCAHkAQQBHAFUAQQBZAFEAQgAwAEEARwBVAEEASwBBAEEAawBBAEgATQBBAGMAQQBCAHMAQQBHAGsAQQBkAEEAQgBmAEEASABBAEEAWQBRAEIAeQBBAEgAUQBBAGMAdwBCAGIAQQBEAEEAQQBYAFEAQQBwAEEAQQBvAEEASgBnAEEAawBBAEcAVQBBAGUAQQBCAGwAQQBHAE0AQQBYAHcAQgAzAEEASABJAEEAWQBRAEIAdwBBAEgAQQBBAFoAUQBCAHkAQQBBAD0APQA=’ <192.168.1.45> (1, ‘’, ‘Parameter format not correct - >nul\r\n’) <192.168.1.45> Failed to connect to the host via ssh: Parameter format not correct - >nul fatal: [192.168.1.45]: FAILED! => { “changed”: false, “module_stderr”: “Parameter format not correct - >nul\r\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1 } PLAY RECAP ************************************************************************************************************************************************************* 192.168.1.45 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

What I have checked?

Trying the same playbook with other windows hosts - Successful | Enabled gather facts to true but failed with same error | changed ansible shell type to cmd/PowerShell due to same similar que in internet but unsuccessful.

Specifications:

redhat - ansible 2.9.17 - python 2.7.5 - windows 10

Here is the playbook

  • name: Push App to webserver
    hosts: webserver
    gather_facts: false

tasks:

  • name : Ping Server
    win_ping:
    register: ping_out
    tags:

  • ping

  • debug:
    msg: “{{ ping_out }}”

Attached error log as an attachment due to incorrect formatting. I can’t find any information on this error on the internet.

Can you please help folks?

What happens when you deploy this to another server? Or an entirely fresh one?

(attachments)


The error is literally trying to run a syntax that works for cmd.exe but in PowerShell hence the error ‘Parameter format not correct - >nul’. The fix for this is to either set ansible_shell_type=powershell or change the default shell back to CMD on your Win32 OpenSSH config. If you’ve already tried setting the shell type then it may be because the parameter was set in the wrong place. A simple test is to do `ansible … -e ansible_shell_type=powershell’ in the command line.

Hi,

Thanks to both of you for the reply.

Yes, I can deploy to other win hosts.

I have changed ansible_shell_type=powershell and changed Default shell in win server too. Now i am facing this error:

<192.168.1.45> (1, b’‘, b’Parameter format not correct - >\r\n’)
<192.168.1.45> Failed to connect to the host via ssh: Parameter format not correct - >
fatal: [192.168.1.45]: FAILED! => {
“changed”: false,
“module_stderr”: “Parameter format not correct - >\r\n”,
“module_stdout”: “”,
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,
“rc”: 1
}

Any Help would be much appreciated,
Thanks

Hi Team,

According to the logs it was working on 22 of Feb not working on 23.When i checked the win hosts there was this update [KB4593226] was installed on that day will that effect on ansible ??

Updated to latest

ansible : 3.0.0
ansible-base: 2.10.6
python - 3.6.8

Here this group is my last ray of HOPE.

Thanks

Regards,
Richard Rittu

There’s not much else we can say, the error you have indicates the shell being used in OpenSSH is cmd so trying to run ansible_shell_type=powershell will cause that failure. Either set it to cmd or work out how to change the DefaultShell for your installation on the Windows host. Ansible needs to know the correct shell so it can format the commands it sends to the host properly.

Hi Team,

Tried Installing PowerShell and made it as default shell in win 2016. Still, the error remains the same?

looks like somebody raised a bug in ansible but they redirected to check in this group

https://github.com/ansible/ansible/issues/72961

Any help would be much appreciated.
rr.png

Hi team,

Thanks for your support it seems the openssh7.6 version in windows caused the issue then i updated to latest one, now its working fine.

Hope it helps somebody

Regards,
Richard Rittu

(attachments)

rr.png