So - I'm logging how my dynamic inventory script is called. When I run the following: ansible-playbook -i dynamic_inventory/get_hosts test.yaml -e "group=mygroup"
get_hosts is first called with --list
I tried putting some vars in the list output under _meta.hostvars. I was wondering if that would stop Ansible querying get_hosts with --host for every single group. However it stops it calling --host for *any* group so I'm back to outputting all vars for all groups.
I can't seem to find a way to only need to generate vars for a single group (or host).
One thought - I'm currently using a separate group for each host as that seemed to simplest way to do handle my particular requirements (I'm only ever running a playbook against a single host). You can see above I'm conflating 'host' and 'group' somewhat.
Is this part of the problem or is that unrelated?