Can a Callback change the output of a module

Hi

I’m trying to build my own Callback plugin and I’m still struggling to understand if it’s possible to modify the JSON structured returned by a module within a Callback plugin or not.
I would like to collect information from all tasks and process them at the end to determine if a specific task should return PASS or FAIL

BTW, is there an API doc available for the Callback plugin ? that would be very useful.

Thanks
Damien

Short answer: no. Callbacks were designed to receive data, not feed data back into the executor engine. Now, some users have found ways to make callbacks do some tricky things, but it’s definitely not their intended purpose.

As for docs, unfortunately not yet. We’ve got better developer docs on the top of our documentation todo list, as well as API documentation, so hopefully we’ll see some improvement there within the next couple of releases.

Callbacks really seem to be intended for reporting and generating specific output but this sounds like an interesting thing that you are attempting to achieve - can you describe it any more detail just in case there’s another way to solve the problem?

From what you’ve said it might be possible that failed_when meets your needs: http://docs.ansible.com/ansible/playbooks_error_handling.html although I get the impression you are trying something more sophisticated.

Jon

changed_when/failed_when are there to deal with modifying a task output status, callbacks execute AFTER this happens, so even if you modify the data it won’t modify the actual status of the tasks.