# Id from multiple machines?

**URL:** <https://forum.ansible.com/t/id-from-multiple-machines/29399>\
**Category:** Ansible Project\
**Created:** [January 8, 2019, 9:22pm UTC](https://forum.ansible.com/t/id-from-multiple-machines/29399 "2019-01-08T21:22:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric.dunn](https://avatars.discourse-cdn.com/v4/letter/e/c2a13f/32.png) [@eric.dunn](https://forum.ansible.com/u/eric.dunn)\
**Post date:** [January 8, 2019, 9:22pm UTC](https://forum.ansible.com/t/id-from-multiple-machines/29399/1 "2019-01-08T21:22:49Z")

</div>

Hi. I’m attempting to retrieve a specific id from multiple machines with the uri module.

The below ansible tasks can achieve the operation on one machine.

What is the best way to retrieve the ID from several machines?

- name: Retrieve Orchid MID  
uri:  
url: “{{ myurl }}”  
force\_basic\_auth: yes  
user: admin  
password: “{{ mypassword }}”  
timeout: 20  
register: machineid

- name: DEBUG Retrieve Orchid MID  
debug:  
msg: “{{ machineid.json.orchids[0].mid }}”

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [January 8, 2019, 9:43pm UTC](https://forum.ansible.com/t/id-from-multiple-machines/29399/2 "2019-01-08T21:43:40Z")

</div>

I am pretty sure that if you loop, the registered variable will contain a list of results, one from each iteration.

- name: Retrieve Orchid MID  
uri:  
url: “{{ item.url }}”  
force\_basic\_auth: yes  
user: admin  
password: “{{ item.password }}”  
timeout: 20  
with\_items: “{{ my\_list\_of\_urls }}”

register: machineids

Your list would look like this:

vars:

my\_list\_of\_urls:

- url: url\_1

password: password\_1

- url: url\_2

password: password\_2

- url: url\_3

password: password\_3

And afterwards, machineids should contain a list of machineid results. Use debug to check the exact internal structure of the variable.

I HAVE NOT TESTED THIS, it is just a guess.

Regards, K.
