[SOS] Error with self-developed shell module

hi,

I wrote a simple shell script and made it as Ansible module with putting it under Library Path. I ran the module and got the failure message. However, I can tell from the output message that the shell module has been run actually. So I don’t understand why Ansible returns such failure message.

Below has the detail, the OS type of target system is AIX

root@b1a52ef5f33f:/usr/share/my_modules# ansible aix -m getos
9.123.195.164 | FAILED! => {
“changed”: false,
“failed”: true,
“module_stderr”: “”,
“module_stdout”: “AIX lpar1 1 7 00CB4D6E4C00\r\n”,
“msg”: “MODULE FAILURE”,
“parsed”: false
}

root@b1a52ef5f33f:/usr/share/my_modules# cat getos
#!/bin/sh

uname -a

Meanwhile, I used the test-module utility to test my shell module and see error with “ValueError: No JSON object could be decoded”. So I assume that is the root cause maybe.

root@b1a52ef5f33f:/ansible# hacking/test-module -m /usr/share/my_modules/getos

  • including generated source, if any, saving to: /root/.ansible_module_generated
  • this may offset any line numbers in tracebacks/debuggers!

"AIX lpar1 1 7 00CB4D6E4C00\r\n",

^ that is not JSON, modules MUST return JSON to Ansible.