We have a nice guide for developing external inventory scripts: 
http://www.ansibleworks.com/docs/developing_inventory.html

The key piece for your question:

"When the external node script is called with the single argument ‘–list’, the 
script must return a JSON hash/dictionary of all the groups to be managed."


On Dec 12, 2013, at 5:53 PM, E.C. Raymond <[email protected]> wrote:

> We have a database that is populated with host and group information.  I have 
> searched through various documents on the ansible site and looked at the 
> inventory plugins, but I am not sure how to implement what I need.
> 
> We currently have a custom lookup script that does what we need, so I am just 
> trying to pass a call to this from ansible.
> 
> example:
> # hostlookup role dbservers
>       db1
>       db2
>       db3
> 
> I want to be able to pass the "dbservers" role/group to my custom inventory 
> script.
> 
> # ansible -i lookup.py dbservers -m ping
> 
> I am unclear on what sys.argv/argument ansible passes, on how to get this 
> passed to an internal function for my custom inventory script.
> 
> 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to