# Storing facts on remote hosts

**URL:** <https://forum.ansible.com/t/storing-facts-on-remote-hosts/21304>\
**Category:** Ansible Project\
**Created:** [April 28, 2016, 4:02pm UTC](https://forum.ansible.com/t/storing-facts-on-remote-hosts/21304 "2016-04-28T16:02:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Volodymyr\_Linevych](https://avatars.discourse-cdn.com/v4/letter/v/f07891/32.png) [@Volodymyr\_Linevych](https://forum.ansible.com/u/Volodymyr_Linevych)\
**Post date:** [April 28, 2016, 4:02pm UTC](https://forum.ansible.com/t/storing-facts-on-remote-hosts/21304/1 "2016-04-28T16:02:05Z")

</div>

Hello, Ansible users!

I am trying to make a group of variables persistent on hosts, preferably as a text file.  
I was using puppet+facter before and now I’m looking for a native way to accomplish this with ansible.

My task:

1. Facts are being initialised only once, when host is provisioned
2. Facts are stored as a text file on remote host and are reusable from any other scripts on that host
3. Facts are automatically read into ansible vars from file once ansible connects to a host

At this moment I’ve tried following:

- ‘[include\_vars](http://docs.ansible.com/ansible/include_vars_module.html)’ works only with local file

- ‘[set\_fact](http://docs.ansible.com/ansible/set_fact_module.html)’ facts are not persistent

- [fact caching](http://docs.ansible.com/ansible/playbooks_variables.html#fact-caching)saves facts on local machine

- ‘[facter](http://docs.ansible.com/ansible/facter_module.html)’ module cannot store facts on host, it can only retrieve existing

It looks like that my task can be accomplished with a custom inventory script, but before I spend a week on this, I’m asking here.

Thanks!

---

<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:** [April 28, 2016, 11:31pm UTC](https://forum.ansible.com/t/storing-facts-on-remote-hosts/21304/2 "2016-04-28T23:31:47Z")

</div>

/etc/ansible/facts.d on the target nodes might be what you are looking for.

See [http://docs.ansible.com/ansible/playbooks\_variables.html#local-facts-facts-d](http://docs.ansible.com/ansible/playbooks_variables.html#local-facts-facts-d)
