Put Zuul vars in an ansible vars file

This adds a vars file for use by ansible playbooks with all vars
scoped under 'zuul'.  The existing environment variables will be
moved into this section in a later change.  Currently, the only
supplied variable is 'uuid' for use in a test.

Also, add a test-specific vars entry (zuul._test) so that we can
pass information such as the test chroot into playbooks used in
our tests.  This is used by a test to set a flag file inside of
the test chroot to verify that the ansible playbook in a job
actually ran and did something.

Change-Id: Ie5d950d051accad4ec9dc90a9e1b01b3095a1e5c
Co-Authored-By: Monty Taylor <mordred@inaugust.com>
diff --git a/tests/base.py b/tests/base.py
index 83354c9..2d1dd7d 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -676,6 +676,7 @@
     """
     def __init__(self, *args, **kw):
         self._run_ansible = kw.pop('_run_ansible', False)
+        self._test_root = kw.pop('_test_root', False)
         super(RecordingLaunchServer, self).__init__(*args, **kw)
         self.hold_jobs_in_build = False
         self.lock = threading.Lock()
@@ -724,6 +725,9 @@
         job.build = build
         self.running_builds.append(build)
         self.job_builds[job.unique] = build
+        args = json.loads(job.arguments)
+        args['zuul']['_test'] = dict(test_root=self._test_root)
+        job.arguments = json.dumps(args)
         super(RecordingLaunchServer, self).launchJob(job)
 
     def stopJob(self, job):
@@ -1252,7 +1256,9 @@
         self._startMerger()
 
         self.launch_server = RecordingLaunchServer(
-            self.config, self.connections, _run_ansible=self.run_ansible)
+            self.config, self.connections,
+            _run_ansible=self.run_ansible,
+            _test_root=self.test_root)
         self.launch_server.start()
         self.history = self.launch_server.build_history
         self.builds = self.launch_server.running_builds