Access to external fact

39 views
Skip to first unread message

antony.p...@polyconseil.fr

unread,
Sep 14, 2014, 10:40:54 AM9/14/14
to ansible...@googlegroups.com
Hello,

My problem is simple. I created a script that return a json with server network informations when run: script.py --host <hostname>.
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 <hostname>.
Any idea ?

Michael DeHaan

unread,
Sep 14, 2014, 1:01:40 PM9/14/14
to ansible...@googlegroups.com
Some useful info if you haven't read both of them already:


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!

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c9f137fa-37d8-4bc4-ac5f-a0213063e358%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages