# callback plugin api; are there changes between v2.0 and v.2.1.1?

**URL:** <https://forum.ansible.com/t/callback-plugin-api-are-there-changes-between-v2-0-and-v-2-1-1/21830>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [June 22, 2016, 11:19am UTC](https://forum.ansible.com/t/callback-plugin-api-are-there-changes-between-v2-0-and-v-2-1-1/21830 "2016-06-22T11:19:04Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [June 22, 2016, 11:19am UTC](https://forum.ansible.com/t/callback-plugin-api-are-there-changes-between-v2-0-and-v-2-1-1/21830/1 "2016-06-22T11:19:04Z")

</div>

Hi,  
I’ve been testing with ansible 2.1.1 rc1 this week and have hit a problem with my custom callback plugin (that gets kerberos tickets for connecting to windows hosts).

The callback code is here: [https://github.com/jhawkesworth/ansible/commit/38b639ac1c2fae90177a87eff5611d62ff8ad00f](https://github.com/jhawkesworth/ansible/commit/38b639ac1c2fae90177a87eff5611d62ff8ad00f)  
(actually with a slight difference, I’m still looking for the ‘@’ in ansible\_ssh\_user instead of ‘ansible\_user’)

In 2.1.1 it is giving out the following warning and the debug shows its not matching any hosts with @ in the ansible\_(ssh\_)user host group vars.

[WARNING]: Failure using method (v2\_playbook\_on\_task\_start) in callback plugin  
(\</root/ansible/lib/ansible/plugins/callback/profile\_tasks.CallbackModule object  
at 0x26a0790\>): ‘dict’ object has no attribute ‘\_data\_source’

Can anyone point me to where \_data\_source is / was before I start digging in with print statements)

Many thanks,

Jon

---

<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:** [June 23, 2016, 4:55pm UTC](https://forum.ansible.com/t/callback-plugin-api-are-there-changes-between-v2-0-and-v-2-1-1/21830/2 "2016-06-23T16:55:37Z")

</div>

Ok, the failure to connect to the domain seems to be unrelated and of course the warning is coming from profile\_tasks, not my plugin.

Looks like it only happens when running with -vvv (see last line of \_record\_task) so probably a bit of a non-issue for ordinary usage.

Unless anyone volunteers I’ll put it on my backlog of things to investigate.

def \_record\_task(self, task):  
“”"  
Logs the start of each task  
“”"  
self.\_display.display(tasktime())  
timestamp(self)

# Record the start time of the current task

self.current = task.\_uuid  
self.stats[self.current] = {‘time’: time.time(), ‘name’: task.get\_name()}  
if self.\_display.verbosity \>= 2:  
**self.stats[self.current][‘path’] = task.get\_path()**

def v2\_playbook\_on\_task\_start(self, task, is\_conditional):  
self.\_record\_task(task)

---

<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 13, 2016, 2:01pm UTC](https://forum.ansible.com/t/callback-plugin-api-are-there-changes-between-v2-0-and-v-2-1-1/21830/3 "2016-07-13T14:01:58Z")

</div>

So, I was mistaken, something seems to have changed between 2.0 and 2.1.

My plugin gets a a list of hosts during v2\_playbook\_on\_play\_start like this

hosts= args[0].get\_variable\_manager().\_inventory.get\_hosts()

Then I loop through the hosts and do a

host\_group\_vars = host.get\_group\_vars()

If I checkout stable-2.0 my plugin will run but devel, stable-2.1 and 2.1.1rc2 all fail because host\_group\_vars is empty.

Is there another to get the group vars that apply to a host? (or more specifically the ansible\_user and ansible\_pass, since that’s what I need to automatically acquire a kerberos ticket?

Jon
