My script doesn't return my full inventory. Only specific information about 
host. I would like to use classic inventory file and retrieve aditional 
information with my script.

Exemple:
MyScript.py --host myhost
Return :
{
   "device" : "eth0",
   "netmask" : "255.255.255.0",
   "bootproto" : "static",
   "gateway" : "192.168.0.1",
   "address" : "192.168.0.12",
},


Le dimanche 14 septembre 2014 19:01:40 UTC+2, Michael DeHaan a écrit :
>
> Some useful info if you haven't read both of them already:
>
> Dynamic inventory:  http://docs.ansible.com/intro_dynamic_inventory.html
> Developing dynamic inventory:  
> 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!
>
> On Sun, Sep 14, 2014 at 10:40 AM, <[email protected] 
> <javascript:>> wrote:
>
>> 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 ?
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/c9f137fa-37d8-4bc4-ac5f-a0213063e358%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/c9f137fa-37d8-4bc4-ac5f-a0213063e358%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4e50b1da-0b93-4c8e-8323-69fd80fa097d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to