Hello,

I'm trying to write callback plugin for ansible.
Below code was working on in ansible-1.9, but it isn't in ansible-2.0

def v2_playbook_on_play_start(self, play):
    self.play = play
    self.playbook = self.play.playbook
    self.inventory = self.playbook.inventory
    self.playbook_name, _ = 
os.path.splitext(os.path.basename(self.playbook.filename))

    for g in self.inventory.get_groups():
        vars = self.inventory.get_group_vars(g)
        print("... vars for group %s" % g.name)
        for v in vars:
             print("%s = %s" % (v, vars.get(v)))
....

Error:
 [WARNING]: Error when using <bound method 
CallbackModule.v2_playbook_on_play_start of <......CallbackModule object at 
0x7fbf9c8c8c50>>: 'Play' object
has no attribute 'playbook'

How should i access group/host variables from callback module in 
ansible-2.0?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0a713754-78a3-4e91-a150-0f3ea1b94c6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to