Shell module failed

31 views
Skip to first unread message

Sluge1 Slug2

unread,
Apr 3, 2015, 8:43:26 AM4/3/15
to ansible...@googlegroups.com
Hello, ansible users,
 
I have created a simple module for ansible:
 
#!/bin/sh
 
hostname
exit 0
 
but this module failed to execute:
# ansible 192.168.1.10 -m test.sh -M /ans_mod
192.168.1.10 | FAILED >> {
    "failed": true,
    "msg": "mngclient.prj.comp.com\r\n",
    "parsed": false
}
 
How to make ansible to execute this module successfully?

Matt Martz

unread,
Apr 3, 2015, 8:49:37 AM4/3/15
to ansible...@googlegroups.com
Modules must return JSON data not just a single string.
--
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.
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/bec642ac-3a5d-4a65-8245-797ad2ea5043%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Sluge1 Slug2

unread,
Apr 3, 2015, 9:26:03 AM4/3/15
to ansible...@googlegroups.com
Matt, thatks a lot for the info
 
How to convert console output to the JSON data?

пятница, 3 апреля 2015 г., 15:49:37 UTC+3 пользователь Matt Martz написал:
Modules must return JSON data not just a single string.

On Friday, April 3, 2015, Sluge1 Slug2 <slu...@gmail.com> wrote:
Hello, ansible users,
 
I have created a simple module for ansible:
 
#!/bin/sh
 
hostname
exit 0
 
but this module failed to execute:
# ansible 192.168.1.10 -m test.sh -M /ans_mod
192.168.1.10 | FAILED >> {
    "failed": true,
    "msg": "mngclient.prj.comp.com\r\n",
    "parsed": false
}
 
How to make ansible to execute this module successfully?

--
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-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

Brian Coca

unread,
Apr 3, 2015, 10:00:27 AM4/3/15
to ansible...@googlegroups.com
echo '{"hostname": "' $(hostname) '"}'
Reply all
Reply to author
Forward
0 new messages