Create an empty mymodule.py file alongside mymodule.ps1; that should allow
the playbook to determine that mymodule is a valid module name.

Previously discussed here:
https://groups.google.com/d/topic/ansible-project/FMlVKR9gDS8/discussion


On Wed, Feb 11, 2015 at 1:15 PM, Ian Clegg <[email protected]> wrote:

> 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
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/b2446014-4606-49e5-b667-21c980cce5ff%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/b2446014-4606-49e5-b667-21c980cce5ff%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH%2BKTJ4Cott6f9HaiD2CkieKqXU_ogm%3DrPpxcXnXfszFYggQVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to