diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py index 4681dd2fe0..a2a7e4f58d 100644 --- a/lib/ansible/callbacks.py +++ b/lib/ansible/callbacks.py @@ -108,6 +108,12 @@ def log_unflock(runner): except OSError: pass +def set_playbook(callback, playbook): + ''' used to notify callback plugins of playbook context ''' + callback.playbook = playbook + for callback_plugin in callback_plugins: + callback_plugin.playbook = playbook + def set_play(callback, play): ''' used to notify callback plugins of context ''' callback.play = play diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index dc7991aaf7..439c60b685 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -148,6 +148,7 @@ class PlayBook(object): self.filename = playbook (self.playbook, self.play_basedirs) = self._load_playbook_from_file(playbook, vars) ansible.callbacks.load_callback_plugins() + ansible.callbacks.set_playbook(self.callbacks, self) # *****************************************************