Maybe I am making too much of an assumption here. But generally you would store the host groupings in some way in your custom inventory/cmdb.
Then, using that information (hosts + groupings) you return something from your inventory script that looks similar to http://www.ansibleworks.com/docs/developing_inventory.html#id2 where the top level keys of the json response are the groups, that contain a list of hosts. Also, you can have hosts in more than a single group. But from my previous response, if you need to pass info into your inventory, you need to use environment variables. -- Matt Martz [email protected] On December 12, 2013 at 6:03:51 PM, E.C. Raymond ([email protected]) wrote: When I run ansible in one-liner mode: ansible webserver --list-hosts; ansible webserver -m ping How am I able to pass the "webserver" argument to the inventory script? I am not understanding from the documentation and examples of how the execution flow works with ansible and inventory scripts. The documentation seems to indicate that the inventory needs to dump ALL hosts and groups, and then to create a dictionary grouping the host --> group, and then dumps the group and hosts. When running: ./my_custom_inventory --list there is no grouping passed to identify which servers should be stored together. I apologize for the confusing post, but I am just trying to understand how I should pass arguments to my custom api calls and return back something that ansible will understand. The closest I am able to getting something similar to what I want is from the ec2 inventory example. Using the region to help dictate what list to pass into the call to gather the list of hosts. -- 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.
