How to display JSON when async does not return valid JSON

Hi,

I’m trying to debug a problem where Ansible is reporting that the async task failed to return valid JSON. Is there a way to see the invalid JSON content that was returned? I’m running into a response similar to what’s described in this post. From trial and error, I know that an RPM I deploy earlier in the play somehow contributes to the failure. I suspect whatever output is in the invalid JSON response would provide guidance as to what’s going on with the failing RPM / Ansible async interaction.

I am using become_user, with a loop, so at first issue #13965 looked to be relevant. However, I’m running 2.0.1.0, so I should have that fix. And if I change the play to install a different RPM or if I simply re-run the playbook after the first failure, the task succeeds. I know the issue is not particular to this one task, since when I comment out this task, things fail similarly on the next task - which also uses become_user, with a loop.

Thanks,
Ed

TASK [target_node : Execute retrieve script] ************************
failed: [target] => (item={u’SERVICE_NAME’: u’testing’, u’NODE_TYPE’: u’P’, u’PORT’: 1432, u’NODE_NUMBER’: 0}) => {“failed”: true, “item”: {“NODE_NUMBER”: 0, “NODE_TYPE”: “P”, “PORT”: 1432, “SERVICE_NAME”: “testing”}, “msg”: “The async task did not return valid JSON: Extra data: line 2 column 1 - line 3 column 1 (char 67 - 183)”}
failed: [target] => (item={u’SERVICE_NAME’: u’testing’, u’NODE_TYPE’: u’S’, u’PORT’: 1433, u’NODE_NUMBER’: 1}) => {“failed”: true, “item”: {“NODE_NUMBER”: 1, “NODE_TYPE”: “S”, “PORT”: 1433, “SERVICE_NAME”: “testing”}, “msg”: “The async task did not return valid JSON: Extra data: line 2 column 1 - line 3 column 1 (char 67 - 183)”}
failed: [target] => (item={u’SERVICE_NAME’: u’testing’, u’NODE_TYPE’: u’S’, u’PORT’: 1434, u’NODE_NUMBER’: 2}) => {“failed”: true, “item”: {“NODE_NUMBER”: 2, “NODE_TYPE”: “S”, “PORT”: 1434, “SERVICE_NAME”: “testing”}, “msg”: “The async task did not return valid JSON: Extra data: line 2 column 1 - line 3 column 1 (char 67 - 183)”}
…ignoring

The root problem turned out to be a permissions issue. The RPM in question is altering the permissions on the home directory of the account used for the async task, which makes it impossible for the account to create the ~/.ansible_async/ directory. I assume that the failure to create the directory is what’s hidden behind the invalid JSON message that Ansible returned.