localhost getting all variables from different groups.

Hello,
I’m looking for advice on how to improve my implementation of my playbook. I know the way I have designed it is very different from the normal way of doing playbooks. I have a playbook that controls deploying configuration to 4 different kubernetes clusters. I use kubectl in a command shell to execute the commands to do deployments. Here is my inventory file:

`

Inventory File

Yes, localhost will get them all and the last one is being used.

Since you are not using hostnames in the inventory why not just use some fake hostname instead of localhost and keep ansible_connection=local.

Since ansible_connection is local it will still run on the localhost.

This will work:

east.k.tropo.com
east2.k.tropo.com
k8s.int.ops.tropo.com
k8s.k.dub.tropo.com
test.c.tropo.com
[group_vars:all]
ansible_connection=local

Just remember that the host is the main object for ansible plays,
groups are just properties of the host and a convenient way to bulk
assign vars. Groups are not their own entity outside of inventory
definition.