# Host output to Ansible-control

**URL:** <https://forum.ansible.com/t/host-output-to-ansible-control/24431>\
**Category:** Ansible Project\
**Created:** [May 9, 2017, 4:19pm UTC](https://forum.ansible.com/t/host-output-to-ansible-control/24431 "2017-05-09T16:19:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sourabh\_maheshwari](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@sourabh\_maheshwari](https://forum.ansible.com/u/sourabh_maheshwari)\
**Post date:** [May 9, 2017, 4:19pm UTC](https://forum.ansible.com/t/host-output-to-ansible-control/24431/1 "2017-05-09T16:19:36Z")

</div>

Hey ,

I am trying to find out the java version of different host using this script

---

<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:** [May 10, 2017, 7:12pm UTC](https://forum.ansible.com/t/host-output-to-ansible-control/24431/2 "2017-05-10T19:12:46Z")

</div>

You would need to use register: on that task to store the output.  
[https://docs.ansible.com/ansible/playbooks\_variables.html#registered-variables](https://docs.ansible.com/ansible/playbooks_variables.html#registered-variables)

Then you can make a new task with the template module.  
[https://docs.ansible.com/ansible/playbooks\_templating.html](https://docs.ansible.com/ansible/playbooks_templating.html)

In the template you can create what you will by looping over all the hosts and print it there individual output.

The template task you would need to use "run\_once: true" and "delegate\_to: localhost" so it only run one time on the Ansible control machine.
