Use uuid if exists as env variable in the callback_plugin

Use uuid if it has been exported by the runner in order
to share the same id for building the log path.
With this uniq id, we can get easy access between
ansible run and json output written by the callback.

Change-Id: I476ab6de37c6f912772a8ddf0cdd241497641d17
This commit is contained in:
Mathieu Bultel 2020-03-11 10:33:55 +01:00 committed by Gael Chamoulaud
parent b6d66646b8
commit d48b4b7714

View File

@ -20,7 +20,7 @@ __metaclass__ = type
import datetime
import json
import time
import os.path
import os
from functools import partial
@ -147,7 +147,8 @@ class CallbackModule(CallbackBase):
log_file = "{}/{}_{}_{}.json".format(
VALIDATIONS_LOG_DIR,
self.results[0].get('play').get('id'),
(os.getenv('ANSIBLE_UUID') if os.getenv('ANSIBLE_UUID') else
self.results[0].get('play').get('id')),
self.env['playbook_name'],
self.current_time)