When you say “pass a group to”, are you talking about when using the inventory 
script with ansible-playbook?


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

> Hi James,
> 
> I have checked out the document before, but I am under the impression that I 
> am not able to pass a group to my custom inventory script through the ansible 
> command without making modifications to the ansible inventory modules.  The 
> database we have already organizes our hosts by role and returns the list of 
> hostnames.  I only need to pass the groupname to my inventory script. This 
> doesn't seem available without making modifications.
> 
> On Thursday, December 12, 2013 3:09:24 PM UTC-8, James Tanner wrote:
> 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.

-- 
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