I’m attempting to create a new plugin to direct playbook output (failures and causes) to my company’s logging and messaging utilities.
The only thing missing at the moment is information about the machines the playbook is run against. I anticipate them being Amazon EC2 instances which return tags as ansible hostvars. However, I cannot seem to find any way to access hostvars from the plugin. I’m currently using the “on_any” function to capture as much information as possible, but the hostvars for the involved hosts don’t seem to be included.
I could setup a debug task in the playbook to process the variables through the “runner_on_ok” function, but thought that it would be a better solution to keep all requirements internal to the plugin.
What is the best way to access hostvars in a plugin?