# Nested Loop Registed Variable

**URL:** <https://forum.ansible.com/t/nested-loop-registed-variable/18713>\
**Category:** Ansible Project\
**Created:** [July 9, 2015, 12:19am UTC](https://forum.ansible.com/t/nested-loop-registed-variable/18713 "2015-07-09T00:19:59Z")\
**Posts on this page:** 2\
**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:** [July 9, 2015, 12:19am UTC](https://forum.ansible.com/t/nested-loop-registed-variable/18713/1 "2015-07-09T00:19:59Z")

</div>

Hi folks,

Need some help related to registered variables.

The first task in my playbook performs some operations over a nested loop and I’m registering a variable for its results. The variable looks like this -

“n\_init”: {  
“changed”: true,  
“failed”: true,  
“msg”: “One or more items failed.”,  
“results”: [  
{  
“changed”: true,

---

<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:** [July 9, 2015, 9:06pm UTC](https://forum.ansible.com/t/nested-loop-registed-variable/18713/2 "2015-07-09T21:06:10Z")

</div>

Ok. Did not realize that we can use Jinja2 statement blocks right along with the modules and it doesn’t always have to just a variable expression. Was able to do this by templating.

Regards  
Abhishek
