# How to get the extra\_vars from Ansible Callback?

**URL:** <https://forum.ansible.com/t/how-to-get-the-extra-vars-from-ansible-callback/26167>\
**Category:** Ansible Project\
**Created:** [November 29, 2017, 3:28pm UTC](https://forum.ansible.com/t/how-to-get-the-extra-vars-from-ansible-callback/26167 "2017-11-29T15:28:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephane\_Bernier](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Stephane\_Bernier](https://forum.ansible.com/u/Stephane_Bernier)\
**Post date:** [November 29, 2017, 3:28pm UTC](https://forum.ansible.com/t/how-to-get-the-extra-vars-from-ansible-callback/26167/1 "2017-11-29T15:28:45Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [November 29, 2017, 3:37pm UTC](https://forum.ansible.com/t/how-to-get-the-extra-vars-from-ansible-callback/26167/2 "2017-11-29T15:37:47Z")

</div>

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](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](https://github.com/ansible/ansible/blob/stable-2.4/lib/ansible/plugins/callback/slack.py)

---

<div class="post-metadata">

**Author:** ![Stephane\_Bernier](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Stephane\_Bernier](https://forum.ansible.com/u/Stephane_Bernier)\
**Post date:** [November 29, 2017, 3:52pm UTC](https://forum.ansible.com/t/how-to-get-the-extra-vars-from-ansible-callback/26167/3 "2017-11-29T15:52:02Z")

</div>

Hi Matt,

I will give it a try now.

Thanks
