Starting from version 0.5 of the Ansible Plugin the build environment variables are available during ansible execution.
I'm currently trying to get the job workspace path inside my playbook (which I provide using job DSL) the following way:
TASK [command] *****************************************************************
changed: [10.100.198.9] => {"changed": true, "cmd": ["echo", "$PATH"], "delta": "0:00:00.002428", "end": "2016-07-12 10:49:02.252685", "rc": 0, "start": "2016-07-12 10:49:02.250257", "stderr": "", "stdout": "/usr/local/bin:/usr/bin", "stdout_lines": ["/usr/local/bin:/usr/bin"], "warnings": []}
TASK [command] *****************************************************************
changed: [10.100.198.9] => {"changed": true, "cmd": ["echo", "$WORKSPACE"], "delta": "0:00:00.002479", "end": "2016-07-12 10:49:02.470880", "rc": 0, "start": "2016-07-12 10:49:02.468401", "stderr": "", "stdout": "$WORKSPACE", "stdout_lines": ["$WORKSPACE"], "warnings": []}
Is this the correct way to access them?