# callback plugin Task obj changes

**URL:** <https://forum.ansible.com/t/callback-plugin-task-obj-changes/21833>\
**Category:** Ansible Developer\
**Created:** [June 22, 2016, 1:30pm UTC](https://forum.ansible.com/t/callback-plugin-task-obj-changes/21833 "2016-06-22T13:30:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Biancaniello](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Mike\_Biancaniello](https://forum.ansible.com/u/Mike_Biancaniello)\
**Post date:** [June 22, 2016, 1:30pm UTC](https://forum.ansible.com/t/callback-plugin-task-obj-changes/21833/1 "2016-06-22T13:30:25Z")

</div>

With 2.0, in my callback plugin, I could access the task\_vars like:

`def v2_playbook_on_task_start(self, task, is_conditional): task_vars = task.get_vars() feature = task_vars.get('feature',None) if feature is not None: self._display.display(" Feature: {}".format(feature))`

However, in 2.1, task.get\_vars() returns an empty dict. To access the task\_vars, I have to do this:

`def v2_playbook_on_task_start(self, task, is_conditional): _loader = task._loader task_vars = task.get_variable_manager().get_vars(_loader, task=task) feature = task_vars.get('feature', None) if feature is not None: self._display.display(" Feature: {}".format(feature))`

Is this the preferred method of accessing these vars or is there a better way?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [July 22, 2016, 4:11am UTC](https://forum.ansible.com/t/callback-plugin-task-obj-changes/21833/2 "2016-07-22T04:11:43Z")

</div>

Mike,

Thanks for your post, it was a help to me as I’ve been hit by something similar - and so have a couple of others by the looks of things- see the discussion on [https://github.com/ansible/ansible/pull/16779](https://github.com/ansible/ansible/pull/16779)

Jon
