# Print output of multiple host in a single file

**URL:** <https://forum.ansible.com/t/print-output-of-multiple-host-in-a-single-file/35272>\
**Category:** Ansible Project\
**Created:** [June 2, 2021, 12:22pm UTC](https://forum.ansible.com/t/print-output-of-multiple-host-in-a-single-file/35272 "2021-06-02T12:22:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![R.B\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@R.B\_Kumar](https://forum.ansible.com/u/R.B_Kumar)\
**Post date:** [June 2, 2021, 12:22pm UTC](https://forum.ansible.com/t/print-output-of-multiple-host-in-a-single-file/35272/1 "2021-06-02T12:22:08Z")

</div>

Hello All - Some basics. I have 50+ Cisco Routers. I am running a ansible script to execute “show version” command. The script works well. I am copying the output to a file

But every host creates one file so, i end up having 50+ files with the output. Can i write the output of all the host in a single file? Thanks

regards, RB.

---

<div class="post-metadata">

**Author:** ![NAVEEN](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@NAVEEN](https://forum.ansible.com/u/NAVEEN)\
**Post date:** [June 2, 2021, 12:31pm UTC](https://forum.ansible.com/t/print-output-of-multiple-host-in-a-single-file/35272/2 "2021-06-02T12:31:24Z")

</div>

May be u can use with\_items module.

---

<div class="post-metadata">

**Author:** ![R.B\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@R.B\_Kumar](https://forum.ansible.com/u/R.B_Kumar)\
**Post date:** [June 2, 2021, 4:39pm UTC](https://forum.ansible.com/t/print-output-of-multiple-host-in-a-single-file/35272/3 "2021-06-02T16:39:22Z")

</div>

Thank you. Let me try and let you know

---

<div class="post-metadata">

**Author:** ![Dennis\_McCarthy1](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@Dennis\_McCarthy1](https://forum.ansible.com/u/Dennis_McCarthy1)\
**Post date:** [June 2, 2021, 6:05pm UTC](https://forum.ansible.com/t/print-output-of-multiple-host-in-a-single-file/35272/4 "2021-06-02T18:05:46Z")

</div>

Have you tried Ansibledb? It seems a waste to only get one piece of information.

AnsibleDB can take in the output of the setup module and store it so you can just run curl commands against the API and pull out the version you’re after from all your cisco routers at once. in your case, you’d need to pull down (probably)this collection: [https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios\_facts\_module.html](https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios_facts_module.html)

Once it’s set up, you can query ansibleDB for any other facts you want.

AnsibleDB setup role: [https://github.com/apidb-io/setup\_ansibledb](https://github.com/apidb-io/setup_ansibledb)  
OR AnsibleDB manual setup: [https://github.com/apidb-io/ansibledb\_api\_opensource](https://github.com/apidb-io/ansibledb_api_opensource)  
Ansibledb\_opensource ansible collection to collect the facts: [https://galaxy.ansible.com/apidb/ansibledb\_opensource](https://galaxy.ansible.com/apidb/ansibledb_opensource)

This is a meetup demo of the setup and usage of AnsibleDB but the focus is Linux and Windows servers but with the right collection, it will require minimal setup.  
[https://youtu.be/1vLe7o0BooY](https://youtu.be/1vLe7o0BooY)

I’d be happy to help with the setup.

---

<div class="post-metadata">

**Author:** ![R.B\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@R.B\_Kumar](https://forum.ansible.com/u/R.B_Kumar)\
**Post date:** [June 3, 2021, 1:53pm UTC](https://forum.ansible.com/t/print-output-of-multiple-host-in-a-single-file/35272/5 "2021-06-03T13:53:37Z")

</div>

Thank you. I will try today and get back.
