Hi John,
Apologies for the late reply,

I had figured that out, and you rightly mentioned I had few print statement
in the module, that was causing the problem.

Observation:
I am using python3.6.
Custom module had couple of print statement with f-string, and few print
statement are normal (print statement used before python 3.6). *Print
statement with f-string was not causing any issue, only normal print
statement were causing module to failed.*

Not sure why this behavior though.

Thanks,
Tejas


On Fri, Jan 10, 2020, 18:54 John Westcott <john.westcott...@redhat.com>
wrote:

> Have you figure this out?
> It looks like ansible can’t parse the return from your module.
> Do you have any prints in your module dumping extra data out?
> Ansible should also be giving you stdout and stderr lines with this
> message.
> For example, I wrote a module that prints a message that looks like json
> (but is invalid) and then exists:
>     *print*("{ something: invalid }")
>     module.exit_json(msg="My Exit Message")
>
> And Ansible returned this to me:
> TASK [my_fail]
> ************************************************************************************************************************************************
> fatal: [localhost]: FAILED! => {
>     "changed": false,
>     "module_stderr": “",
>     "module_stdout": "{ something: invalid }\n\n{\"msg\": \"My Exit
> Message\", \"invocation\": {\"module_args\": {}}}\n”,
>     "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error”,
>     "rc": 0
> }
>
>
> -John
>
> On Jan 6, 2020, at 5:15 AM, Tejas Gadaria <refond.g...@gmail.com> wrote:
>
> Hi Team,
>
> I have written custom ansible module. Module suppose to insert data in
> database via graphsql template.
> While executing module via playbook, it does insert the data in database.
> however task is failing with below error,
>
> *    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",*
> *    "rc": 0*
>
>
> I am running this is verbose mode, *module.exit_json *is providing the
> output but in "Failed" state.
> Need your help here.
>
> Thanks,
> Tejas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/76a87b63-dd26-444c-8e5f-5d45efa484c8%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-devel/76a87b63-dd26-444c-8e5f-5d45efa484c8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CAGB-CvTwFNDsH4U6xBQRD2sALJe%2BEHivcC-SUXhTT5jUAemrYg%40mail.gmail.com.

Reply via email to