Pass result data back from ansible

This loads a json file (work/results.json) that the job can write
to.  It will be loaded by the executor after the job completes and
returned to the scheduler.

We can use the data in this file as the reported log URL for the
build.  Later we can use it to supply file/line comments in
reviews.

Change-Id: Ib4eb743405f337c5bd541dd147e687fd44699713
diff --git a/tests/unit/test_v3.py b/tests/unit/test_v3.py
index eae388b..5d49d11 100644
--- a/tests/unit/test_v3.py
+++ b/tests/unit/test_v3.py
@@ -700,3 +700,19 @@
             dict(name='test1', result='SUCCESS', changes='1,1'),
             dict(name='test2', result='SUCCESS', changes='1,1'),
         ], ordered=False)
+
+
+class TestDataReturn(AnsibleZuulTestCase):
+    tenant_config_file = 'config/data-return/main.yaml'
+
+    def test_data_return(self):
+        # This exercises a proposed change to a role being checked out
+        # and used.
+        A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
+        self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
+        self.waitUntilSettled()
+        self.assertHistory([
+            dict(name='data-return', result='SUCCESS', changes='1,1'),
+        ])
+        self.assertIn('- data-return test/log/url',
+                      A.messages[-1])