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

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

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

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

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