# register with with\_together not working

**URL:** <https://forum.ansible.com/t/register-with-with-together-not-working/22480>\
**Category:** Ansible Project\
**Created:** [September 5, 2016, 5:16am UTC](https://forum.ansible.com/t/register-with-with-together-not-working/22480 "2016-09-05T05:16:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnsiNoob](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@AnsiNoob](https://forum.ansible.com/u/AnsiNoob)\
**Post date:** [September 5, 2016, 5:16am UTC](https://forum.ansible.com/t/register-with-with-together-not-working/22480/1 "2016-09-05T05:16:16Z")

</div>

I want to use register with loops ([http://docs.ansible.com/ansible/playbooks\_loops.html#using-register-with-a-loop](http://docs.ansible.com/ansible/playbooks_loops.html#using-register-with-a-loop)) to accomplish below tasks:

– Surf through couple of variables arrays in with\_together format and save result to a variable  
– now surf through that result set variable and perform specific action.

My register works fine with usual playbooks but the moment I use register with with\_together then no value is saved in variable? ☹

**My playbook:**

- name: check for port on remote host  
hosts: localhost  
connection: local  
vars\_files:
- vars1.yml

tasks:

- name: check for ports  
debug: msg=“x is {{ item.0 }}, y is {{ item.1 }} and z is {{ item.2 }}”  
with\_together:

- “{{ x }}”

- “{{ y }}”

- “{{ z }}”  
register: result

- debug: var=result.stdout\_lines

**My Variables File:**

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 6, 2016, 11:57am UTC](https://forum.ansible.com/t/register-with-with-together-not-working/22480/2 "2016-09-06T11:57:00Z")

</div>

> My register works fine with usual playbooks but the moment I use register  
> with with\_together then no value is saved in variable? ☹

That's because all the with\_ that combines data have a different schema than ordinary register.

> \*My playbook:\*  
> - name: check for port on remote host  
> &nbsp;&nbsp;hosts: localhost  
> &nbsp;&nbsp;connection: local  
> &nbsp;&nbsp;vars\_files:  
> &nbsp;&nbsp;&nbsp;&nbsp;- vars1.yml
> 
> &nbsp;&nbsp;tasks:  
> &nbsp;&nbsp;&nbsp;&nbsp;- name: check for ports  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;debug: msg="x is {{ item.0 }}, y is {{ item.1 }} and z is {{ item.2  
> }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with\_together:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "{{ x }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "{{ y }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "{{ z }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;register: result
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- debug: var=result.stdout\_lines

Try  
&nbsp;&nbsp;&nbsp;- debug: var=result  
instead and you will see that the schema is different for the with\_'s

---

<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:** [September 10, 2016, 12:17am UTC](https://forum.ansible.com/t/register-with-with-together-not-working/22480/3 "2016-09-10T00:17:59Z")

</div>

Any time you use with\_ (loops) you’ll get a ‘results’ key with a list of the normal task results per item of the loop.
