Is it the only way?

I do really want to avoid to iterate through each host (instead of using 
arrays) and produce duplicate data...



On Tuesday, April 21, 2015 at 4:00:10 PM UTC+2, Serge van Ginderachter 
wrote:
>
> use the '_meta' key
>
>
> http://docs.ansible.com/developing_inventory.html#tuning-the-external-inventory-script
>  
> <http://www.google.com/url?q=http%3A%2F%2Fdocs.ansible.com%2Fdeveloping_inventory.html%23tuning-the-external-inventory-script&sa=D&sntz=1&usg=AFQjCNHhi-kh5fXMlqEEoLOxBATE2mr68w>
>
> On 21 April 2015 at 13:14, spezam <[email protected] <javascript:>> wrote:
>
>> Hello,
>> I'm trying to develop a script for dynamic inventory, following this 
>> (poor) documentation
>> http://docs.ansible.com/developing_inventory.html
>>
>> I tested the script with the command
>> *ansible --list-hosts database*
>> which works fine and return the database hosts.
>>
>> I logged the calls to the script and I can see the first call made by 
>> ansible (--list) outputs the list of hosts and their groups
>>
>> {
>>     "database": {
>>         "hosts": [
>>             "host1",
>>             "host2"
>>         ]
>>     },
>>     "apache": {
>>         "hosts": [
>>             "host3",
>>             "host4"
>>         ]
>>     }
>> }
>>
>>
>> Ansible then iterates through all the hosts and call the script with 
>> --host <hostname>.
>>
>> ["--list"]
>> ["--host", "host1"]
>> ["--host", "host2"]
>> ["--host", "host3"]
>> ["--host", "host4"]
>>
>>
>>
>> The performance problem obviously appears when the list of hosts and 
>> groups grows.
>> While I expect the '--host' call to be done only on the database hosts, 
>> it seems ansible is iterating through the full catalog.
>>
>> Is that expected? Any way I can avoid this behavior?
>>
>> Thanks,
>> Matteo
>>
>>  -- 
>> 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/4858255e-6140-4f14-b7d7-1f8a45df1a34%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/4858255e-6140-4f14-b7d7-1f8a45df1a34%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/c804a8a5-d46c-4f9d-bb91-869fe82ec0b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to