ansible-runner icon indicating copy to clipboard operation
ansible-runner copied to clipboard

Alter awx_display - add more information about tasks to event_data

Open urbanchef opened this issue 1 year ago • 1 comments

In my project I process event_data and form a custom report on tasks that has been executed, their status, etc.. I wonder how and if at all possible would be to add TaskResult._task.check_mode or any other TaskResult's or task's properties to event_data in awx_display?

For example,

    result = ansible_runner.run(....)

    for e in result.events:
        if e['event_data']['task_check_mode']:
            print(e)

Task properties data is injected here: https://github.com/ansible/ansible-runner/blob/d467662f585f5bb6ed2c5e8d57f130772760031a/ansible_runner/display_callback/callback/awx_display.py#L408-L414

I would like it to be:

        task_ctx = dict(
            task=(task.name or task.action),
            task_uuid=str(task._uuid),
            task_action=task.action,
            task_check_mode=task.check_mode,
            resolved_action=getattr(task, 'resolved_action', task.action),
            task_args='',
        )

Would you consider accepting such a PR?

urbanchef avatar Mar 27 '23 17:03 urbanchef

Hi, @urbanchef I raised the PR that you wanted. If any changes are still required please do let me know. Please review it. Thanks!!

NaincyKumariKnoldus avatar Apr 14 '23 11:04 NaincyKumariKnoldus