I have a play below that contains a task with a name that has a variable in it.
hosts: localhost
connection: local
vars:
a_variable: test
tasks:
- name: this is a task to echo {{ a_variable }}
shell: echo {{ a_variable }}
When this is run on the command line, the stdout shows the task name with variable resolved/expanded to its value which is this is a task to echo test
However, when I try to access the task name in the callback plugin using the properties task.name or result._task.name, the name returned is this is a task to echo {{ a_variable }}
where the variable is not expanded.
How can I get the task name as it is printed on stdout with the variable expanded?