Hi, allI made a simple time module by using golang (http://golang.org/).It can run with "test-module" but when I run with ansible command, did not work.% ansible -vvv all -m time -M . --ask-passSSH password:<127.0.0.1> ESTABLISH CONNECTION FOR USER: sample on PORT 22 TO 127.0.0.1<127.0.0.1> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1366642710.56-42277018789729 && chmod a+rx $HOME/.ansible/tmp/ansible-1366642710.56-42277018789729 && echo $HOME/.ansible/tmp/ansible-1366642710.56-42277018789729'<127.0.0.1> REMOTE_MODULE time.go127.0.0.1 | FAILED => failure encoding into utf-8This is caused by _copy_module in the runner/__init__.py.I am new to ansible but I think the _copy_module assumes only string module.Is this true or wrong? if true, ansible will not support binary module?BTW, golang makes static linked binary which can just copy to the remote and run.It may become good solution to writing module which requires speed.(ah, the file size is big just a little...)Thank you.--
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 ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Here is the sample time module source.
https://gist.github.com/shirou/5444078
This is almost same as http://ansible.cc/docs/moduledev.html#reading-input.
This is a sample output using test-module.
(note: time format is different from other language.)
% ./test-module -m ./main -a "f=2006" # with argument
***********************************
RAW OUTPUT
{"time":"2013"}
%./test-module -m ./main # without argument
***********************************
RAW OUTPUT
{"time":"2013-04-22 23:37:13"}
Since go-lang has JSON library in core library, it is easy to produce
JSON output.
--
WAKAYAMA Shirou
2013/4/23 Michael DeHaan <michael...@gmail.com>:
> Tell you what, do you have a sample source for a go module that produces
> JSON output?
>
> Just a "Hello World" is ok -- I just don't know enough go to write one.
>
> I could then see what it would take to transfer it unaltered.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/852f7814-35e5-4672-8a03-b8ed84d6bf05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.