Hi everyone,
I wonder if anyone has hit this issue. I just upgraded to ansible 1.8.2 and a set of windows playbooks is no longer working. These playbooks do work with the previous version we had; there seem to be some issues around this at the moment.
The problem appears to be related to how ansible locates custom powershell modules defined in a roles library.
Lets look at how the play is laid out, its quite simple:
/roles/myrole/tasks/main.yml
- name: Run my custom module
mymodule: myparam=‘hello world’
/roles/myrole/library/mymodule.ps1
… a custom powershell module
/myplay.yml
- name: MYROLE
hosts: my-servers
gather_facts: no
vars_files: - “{{versions_vars_file}}”
- “{{environment_vars_file}}”
roles: - myrole
lets invoke ansible:
ansible-playbook -i inventory myplay.yml -c winrm
ERROR: mymodule is not a legal parameter in an Ansible task or handler
This worked in 1.7.x
I should point out that I am setting both ‘ansible_connection’ to winrm and passing ‘-c winrm’ in the command line. I would expect powershell modules to be found.
This seems to be a bug in how find_plugin() in /ansible/utils/plugins.py is invoked. When I patched the function to log the value of transport parameter I got:
transport: [‘.py’]
transport: [‘.py’, ‘’]
transport: [‘.py’, ‘’]
So it was an empty string and the suffix was always ‘.py’.
If I patch the 1.8.2 find_plugin() function to add ‘.ps1’ to the suffix list (even when transport is empty) then my problem goes away - I guess, that transport should probably not be empty?
Thanks
Ian