# Nested variables not expanding in callback plugin

**URL:** <https://forum.ansible.com/t/nested-variables-not-expanding-in-callback-plugin/27858>\
**Category:** Ansible Developer\
**Created:** [June 23, 2018, 7:53pm UTC](https://forum.ansible.com/t/nested-variables-not-expanding-in-callback-plugin/27858 "2018-06-23T19:53:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew\_nguyen](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@andrew\_nguyen](https://forum.ansible.com/u/andrew_nguyen)\
**Post date:** [June 23, 2018, 7:53pm UTC](https://forum.ansible.com/t/nested-variables-not-expanding-in-callback-plugin/27858/1 "2018-06-23T19:53:04Z")

</div>

Hello All,

I have the following playbook. In the debug task, examplevar1 is expanding however in the callback it is not. Is there anyway for me to get this working?

---

<div class="post-metadata">

**Author:** ![ipitythaphool](https://avatars.discourse-cdn.com/v4/letter/i/6de8d8/32.png) [@ipitythaphool](https://forum.ansible.com/u/ipitythaphool)\
**Post date:** [June 24, 2018, 7:55pm UTC](https://forum.ansible.com/t/nested-variables-not-expanding-in-callback-plugin/27858/2 "2018-06-24T19:55:39Z")

</div>

You probably want to quote the whole of examplevar2. Eg "this is {{ examplevar1 }}"

I would also use debug: var=examplevar2

---

<div class="post-metadata">

**Author:** ![andrew\_nguyen](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@andrew\_nguyen](https://forum.ansible.com/u/andrew_nguyen)\
**Post date:** [June 25, 2018, 2:27am UTC](https://forum.ansible.com/t/nested-variables-not-expanding-in-callback-plugin/27858/3 "2018-06-25T02:27:32Z")

</div>

Quoting the whole thing doesn’t appear to be working.

---

<div class="post-metadata">

**Author:** ![ipitythaphool](https://avatars.discourse-cdn.com/v4/letter/i/6de8d8/32.png) [@ipitythaphool](https://forum.ansible.com/u/ipitythaphool)\
**Post date:** [June 25, 2018, 9:41pm UTC](https://forum.ansible.com/t/nested-variables-not-expanding-in-callback-plugin/27858/4 "2018-06-25T21:41:14Z")

</div>

I don’t understand exactly what you’re trying to do. It seems to be working as expected?

---

<div class="post-metadata">

**Author:** ![andrew\_nguyen](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@andrew\_nguyen](https://forum.ansible.com/u/andrew_nguyen)\
**Post date:** [June 25, 2018, 10:11pm UTC](https://forum.ansible.com/t/nested-variables-not-expanding-in-callback-plugin/27858/5 "2018-06-25T22:11:34Z")

</div>

Sorry, I should’ve been more clear. In the beginning of the output, I’m printing out the variables (for debugging purposes) from my callback plugin. I would expect to see “This is variable1” and not “This is {{ examplevar1 }}” for examplevar2. The debug task seems to work fine.

PLAY [all] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
{u’examplevar1’: u’variable1’, u’examplevar2’: **u’This is {{ examplevar1 }}'} ← This is coming from the callback plugin.**

Here is what the code looks like in the callback.

def v2\_playbook\_on\_play\_start(self, play):  
print(play.vars)
