Ansible (2.3.1) python module rds creation via boto3 works but get "msg": "MODULE FAILURE"

Hello All,

Disclaimer this is my first Ansible (python) module.
I had posted previously in the ansible-project group and it was suggested to post here in the ansible-devel instead.

I wrote a python modules for our internal use for AWS RDS instance creation, because currently the ansible RDS module provisions instances by default with magnetic media or with io1 provisioned iops (with minimum size of 100GB and rate=1,000 iops) and we require gp2/ssd.
I am passing ENV vars and other standard variables to the module and it completes and creates the RDS instances fine via boto3 calls, however, I’m stuck on perhaps preventing boto3 from returning stdout (which is not in json format), from the module which is causing the failure status?

'Read the Ansible modules and boto docs and tried wrapping the boto3 response with json:
print json.dumps(response) print json.dumps(error)

but then got errors:

`
boto3 stdout “is not JSON serializable”

`

I also tried various attempts via using the python logger docs: https://docs.python.org/2.7/howto/logging.html#configuring-logging-for-a-library

import logging
logging.getLogger('foo').addHandler(logging.NullHandler())

Below is my verbose stdout (omitting a lot of our vars/details)

`
ansible-playbook -i “localhost,” main.yml -vvv

fatal: [localhost]: FAILED! => {
“changed”: false,
“failed”: true,
“module_stderr”: “”,
“module_stdout”: "{u’DBInstance’: {u’PubliclyAccessible’: False, u’MasterUsername’…

‘Accept-Encoding’, ‘content-length’: ‘4847’, ‘content-type’: ‘text/xml’, ‘date’: ‘Wed, 07 Jun 2017 20:13:33 GMT’}}}\n",
“msg”: “MODULE FAILURE”,
“rc”: 0
}
`

For now, I have set ignore to true, but would be grateful for any pointers on how best to resolve this.

here is the public gist:
https://gist.github.com/cmcconnell1/aede4a19a2a41ab2850d55c16ee523f3

Thank you!
Chris