You can access hostvars in a callback, those specified by inventory are
"easiest" such as:
hosts = self.playbook.inventory.get_hosts()
host_vars = self.playbook.inventory.get_variables(hosts[0].name,
self.playbook.vault_password)
You have access to self.task, self.play and self.playbook. All of those
objects have a number of accessible methods and attributes that you can
generally use to find the info you need.
Be aware though, that the v2 code branch will likely cause some backwards
incompatibilities in accessing those attributes in the future.
On Tue, May 12, 2015 at 2:27 PM, Chris Fidao <[email protected]> wrote:
> I haven't been able to find information on this - I've created a callback
> module to create log output that I can save to a database in order to
> display the result of a run in an administrative control panel.
>
> There are some meta data I'd like to put into the database for this
> logging, some of which given to Ansible by way of host variables
>
> I'm wondering if I can access those host variables from within the
> callback module used - I don't see anything obvious when scanning the code
> base.
>
> Thanks!
>
> --
> 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/8ae57895-39da-4f38-9c33-6e93c2ad9abd%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/8ae57895-39da-4f38-9c33-6e93c2ad9abd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Matt Martz
@sivel
sivel.net
--
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/CAD8N0v8Yd7otXnuX08iobaMOm5-wd2jDujGz%2B_x9v3ZBReLvaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.