# Trying to gather facts to write to local file on ansible server

**URL:** <https://forum.ansible.com/t/trying-to-gather-facts-to-write-to-local-file-on-ansible-server/35803>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [September 29, 2021, 8:12pm UTC](https://forum.ansible.com/t/trying-to-gather-facts-to-write-to-local-file-on-ansible-server/35803 "2021-09-29T20:12:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Bidwell](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Chris\_Bidwell](https://forum.ansible.com/u/Chris_Bidwell)\
**Post date:** [September 29, 2021, 8:12pm UTC](https://forum.ansible.com/t/trying-to-gather-facts-to-write-to-local-file-on-ansible-server/35803/1 "2021-09-29T20:12:52Z")

</div>

Hi all!

So this has worked at one point but is no longer.

I’m trying to gather information on each of my rhel clients and write that information to one file on my answer server.

Here is my playbook:

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [September 29, 2021, 8:14pm UTC](https://forum.ansible.com/t/trying-to-gather-facts-to-write-to-local-file-on-ansible-server/35803/2 "2021-09-29T20:14:42Z")

</div>

Your output doesn’t match the provided play, however, I’m guessing you need a `become: no` on the task that has `delegate_to: localhost` on it.

---

<div class="post-metadata">

**Author:** ![Chris\_Bidwell](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Chris\_Bidwell](https://forum.ansible.com/u/Chris_Bidwell)\
**Post date:** [September 29, 2021, 8:40pm UTC](https://forum.ansible.com/t/trying-to-gather-facts-to-write-to-local-file-on-ansible-server/35803/3 "2021-09-29T20:40:56Z")

</div>

Dang! Thank you!

---

<div class="post-metadata">

**Author:** ![Mike\_Eggleston](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mike\_Eggleston](https://forum.ansible.com/u/Mike_Eggleston)\
**Post date:** [September 29, 2021, 8:51pm UTC](https://forum.ansible.com/t/trying-to-gather-facts-to-write-to-local-file-on-ansible-server/35803/4 "2021-09-29T20:51:54Z")

</div>

I’m over at FTC. Give me your email at NOAA and I’ll forward you the playbook I use.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 7, 2021, 4:28pm UTC](https://forum.ansible.com/t/trying-to-gather-facts-to-write-to-local-file-on-ansible-server/35803/5 "2021-10-07T16:28:23Z")

</div>

Don't really need a play, just:

ansible -m gather\_facts --tree /dir/with/json/file/per/host/ all
