I started work on porting my callback plugin and I'm hoping someone can help me get going.
My old plugin used to get at a list of hosts like this (in on_start):
hosts = self.playbook.inventory.get_hosts()
Then I'd loop through the hosts and fetch out host_vars for each one like this:
host_vars = self.play.playbook.inventory.get_variables(
host.name)
Is there any equivalent way of doing the above in V2?
I've been playing with the context_demo plugin and can see it gets passed an
ansible.playbook.Playbook object
when I look at that it has a get_plays method, but that doesn't seem to return anything. Looking through the Playbook code, one of the things it does is load the plugins, so its like I'm trying to get at inventory (via the playbook) before it has been initialised.
Is there another way to get at host vars? Or is there a different callback I can use, after the inventory has been loaded?
Many thanks,
Jon