I use Ansible 1.9.1 on CentOS Linux 7.1.
I just added a win_test.py file with DOCUMENTATION and EXAMPLES. And now I
can use the module like:
- name: Win test module
win_test:
var: value
I did not put the library option inside my ansible.cfg, because the
documentation states the subdir 'library' is automatically searched by
Ansible.
The one thing that doesn't for now is the test-module command.
Trond, I read your work for different Windows modules, so how did you get
the test-module command to work? At which path you execute the commands in
the docs (git clone, source, chmod)?
Op dinsdag 23 juni 2015 16:11:03 UTC+2 schreef Trond Hindenes:
>
> Hi,
> A good way to start is just like you're doing, copying the win_ping file.
> I'd recommend using a custom library path like J H describes above.
>
> A module consists of two files, a .ps1 file which is the actual script and
> a corresponding .py file. On Windows the py file is only used for
> documentation, but it still needs to be available.
> Looking at the documentation for win_ping that module only lists "data" as
> an acceptable parameter, so passing "var" to it won't work without
> modification.
>
> One thing that can easily throw you when getting started with ansible is
> the yml syntax. Yml uses indenting to organize stuff into arrays/lists, so
> if your indentation is wrong you'll get strange errors.
>
> In your example, this should work:
>
> ---
> - name: Test windows
> hosts: all
> tasks:
> - win_test:
> data: "Hello from win_test"
> - name: Another way to specify a play
> win_test: data="Hello2 from win_test"
>
>
>
> On Tuesday, June 23, 2015 at 3:55:57 PM UTC+2, acropia wrote:
>
>> Hi,
>>
>> I want to built some custom modules for Windows. But I ran into some
>> problems:
>>
>> When I read the docs about developing modules, the part about test-module
>> (git clone, source, chmod) is breaking my Ansible installation. I can't
>> find out on which path I have to execute those commands
>>
>>
>> When I copy a module like the win_ping module inside
>> /usr/lib/python2.7/site-packages/ansible/modules/core/ I can execute it
>> with:
>> # ansible windows -m my_test
>>
>>
>> But when I try to use the modul inside a playbook, like:
>>
>> - name: Testmodule
>> my_test: var=value
>>
>> I get an error "my_test is not a legal parameter in an Ansible task or
>> handler".
>>
>> I have read about a subdictory './library' which I creates in
>> /etc/ansible/library. But placing my module over there doesn't work.
>>
>> Any clues?
>>
>
--
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/f541d29e-fe59-4953-9ae3-0d6c7f7c2972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.