I’m new to ansible. And I’m using ansible 1.9 to install apps to my windows machine. But i’ve always run into this problem when using the following command:
ansible windows -m win_chocolatey -c winrm -u Administrator -a ‘package=notepadplusplus’ --ask-vault-pass -vvvv
I’ve run into the same error when I run ansible-playbook. By the way, I could using win_ping to connect my windows host and run win_msi to install apps successfully.
Why win_chocolatey failed? I’m really appreciate to any of your suggestions.
If you run the same command with -vvvvv (5 v's), you'll get everything sent
back on stderr instead of just "Starting t". There may be something in
that output to provide more details on what went wrong.
What was your final solution? I am using the “devel” branch of the ansible-modules-extras and are still experiencing the same issue as you originally posted.
I have cloned ansible-modules-extras to a separate directory. Under that directory …/modules/ansible-modules-extras/windows/ there is a file named init.py.
Similar to the issues you were experiencing i can run an ansible command using the win_chocolatey module but when running a playbook I consistently get the error "
win_chocolatey is not a legal parameter in an Ansible task or handler"
I am unsure of where to go from here. Any advice is appreciated.
You need to make sure the method is WinRM. As Chris mentioned earlier in this thread, ansible will only recognize PowerShell modules when using winrm type.