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 retrieves these, decryptes them using aws 
> kms and presents them to ansible.
> 
> From testing, it looks like Ansible will always grab every host in the 
> inventory, even if ansible-playbook is started with the "limit" parameters. 
> So for example:
> 
> I run 'ansible-playbook site.yml --limit server10'. My (dynamic) inventory 
> constist of servers server01 - server99.
> Ansible's behavior in this case seems to be:
> 1. Call the inventory script with the '--list' parameter to get all 
> hosts/groups.
> 2. For each host, call the inventory script with the '--host <hostname>' 
> param to get host metadata.
> 
> I would argue that the second step is inefficient, because after step 1, 
> Ansible already has enough info to filter out the "unneeded" hosts, so it 
> should only have to perform a single '--host' lookup in order to grab the 
> hostvars of 'server10'

They might be needed in the playbook, and at this stage Ansible doesn't now 
that.
The playbook might use variables from other hosts.


-- 
Kai Stian Olstad

-- 
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/13176881.OLutp7zUlt%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to