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
(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
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)
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