# Access to external fact

**URL:** <https://forum.ansible.com/t/access-to-external-fact/16217>\
**Category:** Ansible Project\
**Created:** [September 14, 2014, 2:40pm UTC](https://forum.ansible.com/t/access-to-external-fact/16217 "2014-09-14T14:40:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![antony.perigault](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@antony.perigault](https://forum.ansible.com/u/antony.perigault)\
**Post date:** [September 14, 2014, 2:40pm UTC](https://forum.ansible.com/t/access-to-external-fact/16217/1 "2014-09-14T14:40:54Z")

</div>

Hello,

My problem is simple. I created a script that return a json with server network informations when run: script.py --host .  
How can I use this facts ? I test with setup module but it seems to need a script that return in first time all servers with script.py --list and next run script.py --host .  
Any idea ?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 14, 2014, 5:01pm UTC](https://forum.ansible.com/t/access-to-external-fact/16217/2 "2014-09-14T17:01:37Z")

</div>

Some useful info if you haven’t read both of them already:

Dynamic inventory: [http://docs.ansible.com/intro\_dynamic\_inventory.html](http://docs.ansible.com/intro_dynamic_inventory.html)  
Developing dynamic inventory: [http://docs.ansible.com/developing\_inventory.html](http://docs.ansible.com/developing_inventory.html)

Basically these are only useful when used as inventory, the ‘setup’ module in Ansible provides variables about the host after talking to them, the inventroy script provides data _before_ talking to them. If you’re asking how to use that script, you chmod +x it and use it as the name of your inventory file.

If you’re asking how to use variables from that script, variables from anywhere in ansible can be used as arguments to modules like {{ variable\_name }}, so those work just like facts from the setup module.

Let us know more specifics about what you’re looking to do and we can perhaps provide other pointers.

Thanks!
