callback: provide the starting dates for playbooks, plays and tasks

The started dates would previously default to "now" but it turns out
that the "now" for the server and the "now" for the ended date that
the callback provides later can be in different time zones.

Change-Id: Ibd48625742cbc4d8a5f4bdbbb389d0c7c4df5a66
This commit is contained in:
David Moreau Simard 2019-09-19 15:14:43 -04:00
parent ce0a38ab48
commit 034d73a4bd
No known key found for this signature in database
GPG Key ID: CBEB466764A9E621
1 changed files with 13 additions and 2 deletions

View File

@ -167,7 +167,12 @@ class CallbackModule(CallbackBase):
# Create the playbook
self.playbook = self.client.post(
"/api/v1/playbooks", ansible_version=ansible_version, arguments=cli_options, status="running", path=path
"/api/v1/playbooks",
ansible_version=ansible_version,
arguments=cli_options,
status="running",
path=path,
started=datetime.datetime.now().isoformat(),
)
# Record the playbook file
@ -193,7 +198,12 @@ class CallbackModule(CallbackBase):
# Create the play
self.play = self.client.post(
"/api/v1/plays", name=play.name, status="running", uuid=play._uuid, playbook=self.playbook["id"]
"/api/v1/plays",
name=play.name,
status="running",
uuid=play._uuid,
playbook=self.playbook["id"],
started=datetime.datetime.now().isoformat(),
)
# Record all the hosts involved in the play
@ -229,6 +239,7 @@ class CallbackModule(CallbackBase):
tags=task.tags,
lineno=lineno,
handler=handler,
started=datetime.datetime.now().isoformat(),
)
return self.task