ERROR! this task 'ansible.windows.win_command' has extra params

1,561 views
Skip to first unread message

jayant yadav

unread,
Mar 18, 2021, 11:12:31 AM3/18/21
to Ansible Project
 Hi Everyone,

I'm getting this error, I've added the playbook below. Please let me know how to fix this error

jayantyadav@DESKTOP-40L7UNL:/etc/ansible$ ansible-playbook editfile.yml
ERROR! this task 'ansible.windows.win_command' has extra params, which is only allowed in the following modules: raw, include_role, add_host, import_role, include, group_by, win_command, command, win_shell, meta, shell, script, set_fact, include_tasks, include_vars, import_tasks

The error appears to be in '/etc/ansible/editfile.yml': line 6, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
  - name: Rename build properties file
    ^ here



Here's the playbook
 1 ---
  2 - name: update file
  3   hosts: app
  4
  5   tasks:
  6   - name: Rename build properties file
  7     ansible.windows.win_command: powershell.exe
  8     args:
  9       stdin: Rename-Item -Path C:\Ansible_Test_Folder\Ansible_Test_File1.txt-NewName.txt
 10 ...
~          

jbor...@gmail.com

unread,
Mar 18, 2021, 5:18:52 PM3/18/21
to Ansible Project
You are using Ansible 2.9 and the ansible.windows collections does not work with this Ansible version (requires 2.10). This is one of the reasons why the minimum version for that collection is 2.10.

Thanks

Jordan
Reply all
Reply to author
Forward
0 new messages