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?