Take a look at the bundled slack callback plugin, it gets access to
extra_vars.  In 2.3:

https://github.com/ansible/ansible/blob/stable-2.3/lib/ansible/plugins/callback/slack.py

The method for getting that info changes in 2.4:

https://github.com/ansible/ansible/blob/stable-2.4/lib/ansible/plugins/callback/slack.py


On Wed, Nov 29, 2017 at 9:28 AM, Stéphane Bernier <[email protected]>
wrote:

> Hi,
>
> I'm facing an issue with Ansible Callbacks when trying to get the
> extra_vars.
> From the v2_playbook_on_start I'm able to get access to the Playbook
> object thanks to the play parameter of the method.
> Unfortunately, I'm not able to get the extra_vars nor the variable_manager
> ...
>
> How can I access the extra_vars from a callback ?
>
> I managed to make it work by adding a reference to the variable_manager
> object into the Playbook object by adding the following lines in the load
> method.
>         pb._variable_manager = variable_manager
>
> It makes the job, but I would like to be sure there is no other way to do
> it.
>
> Our version of Ansible is the 2.3.0.0 but it's not working also with
> 2.3.1.0.
>
> Any advice would be good,
>
> 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/3aab5637-2ed9-4b1f-9030-c5c886d0b6f4%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/3aab5637-2ed9-4b1f-9030-c5c886d0b6f4%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/CAD8N0v8GwsiUAtC3qHGQ4MVXxEVEAiF6R1ZY5a%2Bqkt%2BakxiA%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to