Shell module failed

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?

Modules must return JSON data not just a single string.

Matt, thatks a lot for the info

How to convert console output to the JSON data?

echo '{"hostname": "' $(hostname) '"}'