# Loading facts from json, but not from /etc/ansible/facts.d

**URL:** <https://forum.ansible.com/t/loading-facts-from-json-but-not-from-etc-ansible-facts-d/16836>\
**Category:** Ansible Project\
**Created:** [November 20, 2014, 6:30pm UTC](https://forum.ansible.com/t/loading-facts-from-json-but-not-from-etc-ansible-facts-d/16836 "2014-11-20T18:30:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lorin\_Hochstein](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@Lorin\_Hochstein](https://forum.ansible.com/u/Lorin_Hochstein)\
**Post date:** [November 20, 2014, 6:30pm UTC](https://forum.ansible.com/t/loading-facts-from-json-but-not-from-etc-ansible-facts-d/16836/1 "2014-11-20T18:30:38Z")

</div>

I’d like to load facts for a host that are defined in a JSON file on the control machine. The json file (along with the playbooks) is in a repo that multiple people can check out, and so I don’t want to require that each user who checks out the repo copies this file to /etc/ansible/facts.d.

Is there another way to load a JSON file that lives on the control machine and use its contents to populate variables?

I ended up writing a custom facts module to do this, but it seems like overkill.

Lorin

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 20, 2014, 6:32pm UTC](https://forum.ansible.com/t/loading-facts-from-json-but-not-from-etc-ansible-facts-d/16836/2 "2014-11-20T18:32:49Z")

</div>

you can load it as extra vars with -e @/pathto/jsonfile.json

---

<div class="post-metadata">

**Author:** ![Lorin\_Hochstein](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@Lorin\_Hochstein](https://forum.ansible.com/u/Lorin_Hochstein)\
**Post date:** [November 20, 2014, 6:44pm UTC](https://forum.ansible.com/t/loading-facts-from-json-but-not-from-etc-ansible-facts-d/16836/3 "2014-11-20T18:44:07Z")

</div>

Cool. Is there a way to specify this in the playbook itself (other than in the shebang)? Something like vars\_files that speaks json?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 20, 2014, 7:05pm UTC](https://forum.ansible.com/t/loading-facts-from-json-but-not-from-etc-ansible-facts-d/16836/4 "2014-11-20T19:05:15Z")

</div>

considering that json is a subset of yaml, you should be able to load them.
