From 0d11f53eff624441b72df172057e0afd0ebd5a2d Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 25 Mar 2013 22:47:06 -0400 Subject: [PATCH] Let the callbacks see the playbook and (current) runner objects. --- lib/ansible/playbook/__init__.py | 3 +++ lib/ansible/runner/__init__.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 4d561f3009..a38a328e3d 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -114,6 +114,9 @@ class PlayBook(object): self.private_key_file = private_key_file self.only_tags = only_tags + self.callbacks.playbook = self + self.runner_callbacks.playbook = self + if inventory is None: self.inventory = ansible.inventory.Inventory(host_list) self.inventory.subset(subset) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index fa7537a0e3..6fc7736dcd 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -157,6 +157,8 @@ class Runner(object): self.environment = environment self.complex_args = complex_args + self.callbacks.runner = self + # misc housekeeping if subset and self.inventory._subset is None: # don't override subset when passed from playbook