# Accessing registered variables inside callback plugin

**URL:** <https://forum.ansible.com/t/accessing-registered-variables-inside-callback-plugin/21781>\
**Category:** Ansible Project\
**Created:** [June 15, 2016, 11:06am UTC](https://forum.ansible.com/t/accessing-registered-variables-inside-callback-plugin/21781 "2016-06-15T11:06:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_R](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Abhishek\_R](https://forum.ansible.com/u/Abhishek_R)\
**Post date:** [June 15, 2016, 11:06am UTC](https://forum.ansible.com/t/accessing-registered-variables-inside-callback-plugin/21781/1 "2016-06-15T11:06:21Z")

</div>

Hi,

I have a simple playbook that registers some variables. And I have a mail callback plugin that sends out an email if a playbook run fails (runner\_on\_failed). How do I access the value of a registered variable from within the callback plugin, with the purpose of sending that value across in the email?

I did see various discussions and examples of access hostvars and group vars from within the callback module. But didn’t really find an example of accessing a registered variable.

Any examples or suggestions will be helpful. Thanks in advance.

Regards

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 15, 2016, 3:42pm UTC](https://forum.ansible.com/t/accessing-registered-variables-inside-callback-plugin/21781/2 "2016-06-15T15:42:24Z")

</div>

the ‘results’ you get on callback methods IS the what would be in the registered var for that task.

---

<div class="post-metadata">

**Author:** ![Abhishek\_R](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Abhishek\_R](https://forum.ansible.com/u/Abhishek_R)\
**Post date:** [June 20, 2016, 5:44am UTC](https://forum.ansible.com/t/accessing-registered-variables-inside-callback-plugin/21781/3 "2016-06-20T05:44:21Z")

</div>

Thanks, but would it be available just for the task where it was registered? How do I access the value of the registered variable for a failure-callback of a subsequent task?

Regards
