[ansible-project] More efficient inventory lookups

2017-12-14 Thread Trond Hindenes
We're using a custom inventory script that calls a webservice which again calls the aws ec2 api to list instances. The reason we do this, is that we store auto-generated and unique instance credentials, and the webservice retrieves these, decryptes them using aws kms and presents them to ansibl

Re: [ansible-project] More efficient inventory lookups

2017-12-14 Thread Kai Stian Olstad
On Thursday, 14 December 2017 14.16.43 CET Trond Hindenes wrote: > We're using a custom inventory script that calls a webservice which again > calls the aws ec2 api to list instances. > > The reason we do this, is that we store auto-generated and unique instance > credentials, and the webservice

Re: [ansible-project] More efficient inventory lookups

2017-12-14 Thread Brian Coca
please read https://github.com/ansible/ansible/issues/33840#issuecomment-351508201 or http://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html#tuning-the-external-inventory-script -- -- Brian Coca -- You received this message because you are subscribed to the Googl

Re: [ansible-project] More efficient inventory lookups

2017-12-14 Thread Trond Hindenes
Thanks Brian, I'm aware of the current functionality in regards to the "_meta" object vs list/host. My question is simply if its possible to _not_ populate a full hostvars dict for every node in the inventory in situations where the majority of the nodes are filtered out using the '--limit' I

Re: [ansible-project] More efficient inventory lookups

2017-12-14 Thread Brian Coca
No, as `--limit` does not affect hostvars[anyhost][itsvar], since you need to run the play before you know what variables are consumed we cannot preemptively avoid querying those. You CAN return an empty `_meta` (disables --host calls) and then add a vars plugin that queries that info, vars plugin

Re: [ansible-project] More efficient inventory lookups

2017-12-15 Thread Trond Hindenes
Gotcha, that makes sense. Thanks! On Thursday, December 14, 2017 at 10:38:25 PM UTC+1, Brian Coca wrote: > > No, as `--limit` does not affect hostvars[anyhost][itsvar], since you > need to run the play before you know what variables are consumed we > cannot preemptively avoid querying those. >