Powershell Function via Ansible | Get-AnsibleParam: Missing required argument: _raw_params

Executing a rather large playbook revolving around multiple plays to create shares and DFS links, etc.

I’ve got a play to do the following.

Crickets
:frowning:

What Ansible version are you running, does it also fail with the same error if you did just “- ansible.windows.win_shell: echo ‘hi’”. Does win_command work, what about just “win_shell” and not the FQCN.

I’ve got this that I’m connecting to, doing a metric ton of other things as well, so I’m positive the connection is functional and working.

ansible 2.9.13
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible

python version = 3.6.8 (default, Aug 13 2020, 07:46:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

-------- Test play

The win_shell and win_command modules don’t support cmd as an args like command/shell do. It’s complaining that the raw missing is missing because you haven’t done ‘win_shell: my command’.

So pulling this from docs.ansible.com

  • name: Run a command under a non-Powershell interpreter (cmd in this case) ansible.windows.
    win_shell: echo %HOMEDIR%

args: executable:

cmd

register: homedir_out

I managed to net a better result by specifying the collection at the top of the playbook with
collections:

  • ansible.windows

and making the play

  • name: Hi Jason
    win_shell: echo “HI”

So your particular error is because you are using an Ansible version that is too old. You are trying to run the ‘ansible.windows.win_shell’ collection module but Ansible hardcoded in a check to only allow win_shell (the builtin version). This has been fixed in recent Ansible versions (I cannot which but at least 2.10) and in any case the ansible.windows version requires Ansible 2.10+ anyway. So you either need to update your Ansible version or not use the ansible.windows collection on 2.9.

Got it.

I’m attempting to not have to update just yet, we’re integrating Rundeck organization wide and I’m hoping to just need to convert into their environment and call it a day.

Thanks again